diff options
Diffstat (limited to 'src/parse/span.rs')
| -rw-r--r-- | src/parse/span.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/parse/span.rs b/src/parse/span.rs index 340a078..671c10d 100644 --- a/src/parse/span.rs +++ b/src/parse/span.rs @@ -22,6 +22,12 @@ impl FileId { } } +impl Default for FileId { + fn default() -> Self { + Self::new() + } +} + #[derive(Copy, Clone)] pub struct SpanFrom { pub file: FileId, @@ -52,15 +58,7 @@ pub struct Span { /// manual implementation of PartialOrd to ensure shorter Spans are first impl PartialOrd for Span { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { - match self.file.partial_cmp(&other.file) { - Some(core::cmp::Ordering::Equal) => {} - ord => return ord, - } - match self.start.partial_cmp(&other.start) { - Some(core::cmp::Ordering::Equal) => {} - ord => return ord, - } - other.end.partial_cmp(&self.end) + Some(self.cmp(other)) } } |
