aboutsummaryrefslogtreecommitdiffstats
path: root/src/parse/span.rs
diff options
context:
space:
mode:
authorJonas Maier <jonas@x77.dev>2026-06-01 21:17:23 +0200
committerJonas Maier <jonas@x77.dev>2026-06-01 21:17:23 +0200
commitc52169f535f89c0300ec06e13ddcaa7e0f459a0b (patch)
tree0bc1e2db8779cab539cc572a322981e4efb07c38 /src/parse/span.rs
parent22f8e4a5609e63c2bfc15887769fa2d8d6702f49 (diff)
downloadpish-c52169f535f89c0300ec06e13ddcaa7e0f459a0b.tar.gz
clippy
Diffstat (limited to 'src/parse/span.rs')
-rw-r--r--src/parse/span.rs16
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))
}
}