SourceOffset -> usize in SourceSpan

This commit is contained in:
Gavrilikhin Daniil 2023-05-14 18:46:38 +08:00
parent c25676cb1f
commit 998a7f2130
2 changed files with 5 additions and 5 deletions

View File

@ -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)
}
}

View File

@ -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),
}
}
}