Skip to content

Commit

Permalink
Replace Default impl for Span by derive
Browse files Browse the repository at this point in the history
  • Loading branch information
timsueberkrueb authored and BinderDavid committed Jan 16, 2025
1 parent f0ba5ae commit 6b2fb8c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lang/miette_util/src/codespan.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::ops::{Add, Sub};

/// A byte position in a source file.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ByteIndex(pub u32);

impl ByteIndex {
Expand Down Expand Up @@ -40,7 +40,7 @@ impl ByteOffset {
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Span {
pub start: ByteIndex,
pub end: ByteIndex,
Expand All @@ -58,12 +58,6 @@ impl Span {
}

Check warning on line 58 in lang/miette_util/src/codespan.rs

View check run for this annotation

Codecov / codecov/patch

lang/miette_util/src/codespan.rs#L56-L58

Added lines #L56 - L58 were not covered by tests
}

impl Default for Span {
fn default() -> Span {
Span::initial()
}
}

/// A 1-indexed line number. Useful for pretty printing source locations.
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct LineNumber(u32);
Expand Down

0 comments on commit 6b2fb8c

Please sign in to comment.