Skip to content

Commit 9a1f177

Browse files
committed
Remove cast to usize for BytePos and CharPos
The case shouldn't be necessary and implicitly truncating BytePos is not desirable.
1 parent b4b4a2f commit 9a1f177

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_span/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ macro_rules! impl_pos {
15961596

15971597
#[inline(always)]
15981598
fn add(self, rhs: $ident) -> $ident {
1599-
$ident((self.to_usize() + rhs.to_usize()) as $inner_ty)
1599+
$ident(self.0 + rhs.0)
16001600
}
16011601
}
16021602

@@ -1605,7 +1605,7 @@ macro_rules! impl_pos {
16051605

16061606
#[inline(always)]
16071607
fn sub(self, rhs: $ident) -> $ident {
1608-
$ident((self.to_usize() - rhs.to_usize()) as $inner_ty)
1608+
$ident(self.0 - rhs.0)
16091609
}
16101610
}
16111611
)*

0 commit comments

Comments
 (0)