Skip to content

Commit b87abdc

Browse files
committed
Fix clippy::manual_map
1 parent a8812c1 commit b87abdc

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/float.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ pub trait FloatCore: Num + NumCast + Neg<Output = Self> + PartialOrd + Copy {
166166
/// check(0.0f64, false);
167167
/// ```
168168
#[inline]
169+
#[allow(clippy::eq_op)]
169170
fn is_nan(self) -> bool {
170171
self != self
171172
}

src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,7 @@ macro_rules! float_trait_impl {
252252

253253
fn slice_shift_char(src: &str) -> Option<(char, &str)> {
254254
let mut chars = src.chars();
255-
if let Some(ch) = chars.next() {
256-
Some((ch, chars.as_str()))
257-
} else {
258-
None
259-
}
255+
Some((chars.next()?, chars.as_str()))
260256
}
261257

262258
let (is_positive, src) = match slice_shift_char(src) {
@@ -421,6 +417,7 @@ pub fn clamp<T: PartialOrd>(input: T, min: T, max: T) -> T {
421417
///
422418
/// **Panics** in debug mode if `!(min == min)`. (This occurs if `min` is `NAN`.)
423419
#[inline]
420+
#[allow(clippy::eq_op)]
424421
pub fn clamp_min<T: PartialOrd>(input: T, min: T) -> T {
425422
debug_assert!(min == min, "min must not be NAN");
426423
if input < min {
@@ -438,6 +435,7 @@ pub fn clamp_min<T: PartialOrd>(input: T, min: T) -> T {
438435
///
439436
/// **Panics** in debug mode if `!(max == max)`. (This occurs if `max` is `NAN`.)
440437
#[inline]
438+
#[allow(clippy::eq_op)]
441439
pub fn clamp_max<T: PartialOrd>(input: T, max: T) -> T {
442440
debug_assert!(max == max, "max must not be NAN");
443441
if input > max {

0 commit comments

Comments
 (0)