mirror of
https://github.com/nushell/nushell
synced 2024-12-27 13:33:16 +00:00
Allow empty span slice for now (#529)
This commit is contained in:
parent
c37bdcd119
commit
cf5048205f
1 changed files with 3 additions and 1 deletions
|
@ -48,11 +48,13 @@ impl Span {
|
|||
}
|
||||
}
|
||||
|
||||
/// Used when you have a slice of spans of at least size 1
|
||||
pub fn span(spans: &[Span]) -> Span {
|
||||
let length = spans.len();
|
||||
|
||||
if length == 0 {
|
||||
panic!("Internal error: tried to create a 0-length span")
|
||||
// TODO: do this for now, but we might also want to protect against this case
|
||||
Span { start: 0, end: 0 }
|
||||
} else if length == 1 {
|
||||
spans[0]
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue