diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-10-23 22:19:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-23 22:19:07 +0200 |
| commit | 426c6cf84fd6230240abe5e2e9007fcc7d1cddff (patch) | |
| tree | 43c4e608acb09219bd63e59d10a00d3661fe2cdb /src/libcore | |
| parent | 4a8c5b20c7772bc5342b83d4b0696ea216ef75a7 (diff) | |
| parent | bedbf3bacbff36a477dcf28523cbf6cab67e9e0a (diff) | |
| download | rust-426c6cf84fd6230240abe5e2e9007fcc7d1cddff.tar.gz rust-426c6cf84fd6230240abe5e2e9007fcc7d1cddff.zip | |
Rollup merge of #64178 - mati865:clippy, r=scottmcm
More Clippy fixes for alloc, core and std Continuation of https://github.com/rust-lang/rust/pull/63805
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/fmt/mod.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/dec2flt/algorithm.rs | 9 | ||||
| -rw-r--r-- | src/libcore/option.rs | 5 |
3 files changed, 7 insertions, 9 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 8413b2e0ac4..0e83a282b18 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -2025,7 +2025,7 @@ impl<T: ?Sized> Pointer for *const T { if f.alternate() { f.flags |= 1 << (FlagV1::SignAwareZeroPad as u32); - if let None = f.width { + if f.width.is_none() { f.width = Some(((mem::size_of::<usize>() * 8) / 4) + 2); } } diff --git a/src/libcore/num/dec2flt/algorithm.rs b/src/libcore/num/dec2flt/algorithm.rs index fa3c8075378..ed89852dc48 100644 --- a/src/libcore/num/dec2flt/algorithm.rs +++ b/src/libcore/num/dec2flt/algorithm.rs @@ -143,13 +143,12 @@ pub fn fast_path<T: RawFloat>(integral: &[u8], fractional: &[u8], e: i64) -> Opt /// > not a bound for the true error, but bounds the difference between the approximation z and /// > the best possible approximation that uses p bits of significand.) pub fn bellerophon<T: RawFloat>(f: &Big, e: i16) -> T { - let slop; - if f <= &Big::from_u64(T::MAX_SIG) { + let slop = if f <= &Big::from_u64(T::MAX_SIG) { // The cases abs(e) < log5(2^N) are in fast_path() - slop = if e >= 0 { 0 } else { 3 }; + if e >= 0 { 0 } else { 3 } } else { - slop = if e >= 0 { 1 } else { 4 }; - } + if e >= 0 { 1 } else { 4 } + }; let z = rawfp::big_to_fp(f).mul(&power_of_ten(e)).normalize(); let exp_p_n = 1 << (P - T::SIG_BITS as u32); let lowbits: i64 = (z.f % exp_p_n) as i64; diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 9eb29eae7f7..89f2d7ab29c 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -837,9 +837,8 @@ impl<T> Option<T> { #[inline] #[stable(feature = "option_entry", since = "1.20.0")] pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T { - match *self { - None => *self = Some(f()), - _ => (), + if let None = *self { + *self = Some(f()); } match *self { |
