Skip to content

Commit

Permalink
Remove casts from FullInt impl
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Wright committed Oct 30, 2021
1 parent 665ff57 commit c8edd9a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions clippy_utils/src/consts.rs
Expand Up @@ -230,16 +230,9 @@ pub enum FullInt {
}

impl FullInt {
#[allow(clippy::cast_sign_loss)]
#[must_use]
fn cmp_s_u(s: i128, u: u128) -> Ordering {
if s < 0 {
Ordering::Less
} else if u > (i128::MAX as u128) {
Ordering::Greater
} else {
(s as u128).cmp(&u)
}
u128::try_from(s).map_or(Ordering::Less, |x| x.cmp(&u))
}
}

Expand Down

0 comments on commit c8edd9a

Please sign in to comment.