Skip to content

Commit

Permalink
Remove cast to usize for BytePos and CharPos
Browse files Browse the repository at this point in the history
The case shouldn't be necessary and implicitly truncating BytePos is not
desirable.
  • Loading branch information
Juici committed Sep 21, 2020
1 parent b4b4a2f commit 9a1f177
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_span/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1596,7 +1596,7 @@ macro_rules! impl_pos {

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

Expand All @@ -1605,7 +1605,7 @@ macro_rules! impl_pos {

#[inline(always)]
fn sub(self, rhs: $ident) -> $ident {
$ident((self.to_usize() - rhs.to_usize()) as $inner_ty)
$ident(self.0 - rhs.0)
}
}
)*
Expand Down

0 comments on commit 9a1f177

Please sign in to comment.