Remove cast to usize for BytePos and CharPos

The case shouldn't be necessary and implicitly truncating BytePos is not
desirable.
This commit is contained in:
James Whaley 2020-09-21 19:42:43 +01:00
parent b4b4a2f092
commit 9a1f1777d3
No known key found for this signature in database
GPG Key ID: F03278A61EEDB2CA

View File

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