diff --git a/src/protocol.rs b/src/protocol.rs index 611b827..1e9c7a4 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -492,10 +492,10 @@ pub struct SourceSpan { impl SourceSpan { /// Create a new [`SourceSpan`]. - pub fn new(start: SourceOffset, length: SourceOffset) -> Self { + pub fn new(start: SourceOffset, length: usize) -> Self { Self { offset: start, - length: length.offset(), + length: length, } } @@ -525,8 +525,8 @@ impl From<(ByteOffset, usize)> for SourceSpan { } } -impl From<(SourceOffset, SourceOffset)> for SourceSpan { - fn from((start, len): (SourceOffset, SourceOffset)) -> Self { +impl From<(SourceOffset, usize)> for SourceSpan { + fn from((start, len): (SourceOffset, usize)) -> Self { Self::new(start, len) } } diff --git a/tests/derive.rs b/tests/derive.rs index 7faae42..5715823 100644 --- a/tests/derive.rs +++ b/tests/derive.rs @@ -427,7 +427,7 @@ impl ForwardsTo { fn new() -> Self { ForwardsTo { src: SNIPPET_TEXT.into(), - label: SourceSpan::new(11.into(), 6.into()), + label: SourceSpan::new(11.into(), 6), } } }