diff --git a/src/utils/lines/spans/segment.rs b/src/utils/lines/spans/segment.rs index 2e5048a..3fb02ec 100644 --- a/src/utils/lines/spans/segment.rs +++ b/src/utils/lines/spans/segment.rs @@ -50,7 +50,7 @@ impl Segment { { let span = spans[self.span_id].as_ref(); - if let &IndexedCow::Borrowed { start, .. } = span { + if let IndexedCow::Borrowed { start, .. } = *span { Some((self.start + start, self.end + start)) } else { None diff --git a/src/utils/lines/spans/segment_merge_iterator.rs b/src/utils/lines/spans/segment_merge_iterator.rs index 9d3e202..42e1013 100644 --- a/src/utils/lines/spans/segment_merge_iterator.rs +++ b/src/utils/lines/spans/segment_merge_iterator.rs @@ -23,9 +23,7 @@ where fn next(&mut self) -> Option { if self.current.is_none() { self.current = self.inner.next(); - if self.current.is_none() { - return None; - } + self.current?; } loop { diff --git a/src/utils/span.rs b/src/utils/span.rs index 81d2418..d9cabab 100644 --- a/src/utils/span.rs +++ b/src/utils/span.rs @@ -49,6 +49,12 @@ where r: &'a C, } +impl Default for SpannedString { + fn default() -> Self { + SpannedString::new() + } +} + impl<'a, T> SpannedText for &'a SpannedString { type S = IndexedSpan; @@ -254,7 +260,7 @@ impl SpannedString { } } -impl <'a, T> From<&'a SpannedString> for SpannedStr<'a, T> { +impl<'a, T> From<&'a SpannedString> for SpannedStr<'a, T> { fn from(other: &'a SpannedString) -> Self { SpannedStr::new(&other.source, &other.spans) }