Fix all clippy warnings

This commit is contained in:
Aaron Kutch
2020-12-11 14:45:35 -06:00
parent 1d9d761e9f
commit 1cf47804df
7 changed files with 28 additions and 16 deletions

View File

@@ -137,9 +137,8 @@ where
a_significand <<= shift; a_significand <<= shift;
a_exponent -= shift; a_exponent -= shift;
} }
} else } else {
/* addition */ // addition
{
a_significand += b_significand; a_significand += b_significand;
// If the addition carried up, we need to right-shift the result and // If the addition carried up, we need to right-shift the result and

View File

@@ -63,25 +63,22 @@ fn cmp<F: Float>(a: F, b: F) -> Result {
// a and b as signed integers as we would with a fp_ting-point compare. // a and b as signed integers as we would with a fp_ting-point compare.
if a_srep & b_srep >= szero { if a_srep & b_srep >= szero {
if a_srep < b_srep { if a_srep < b_srep {
return Result::Less; Result::Less
} else if a_srep == b_srep { } else if a_srep == b_srep {
return Result::Equal; Result::Equal
} else { } else {
return Result::Greater; Result::Greater
}
} }
// Otherwise, both are negative, so we need to flip the sense of the // Otherwise, both are negative, so we need to flip the sense of the
// comparison to get the correct result. (This assumes a twos- or ones- // comparison to get the correct result. (This assumes a twos- or ones-
// complement integer representation; if integers are represented in a // complement integer representation; if integers are represented in a
// sign-magnitude representation, then this flip is incorrect). // sign-magnitude representation, then this flip is incorrect).
else { } else if a_srep > b_srep {
if a_srep > b_srep { Result::Less
return Result::Less;
} else if a_srep == b_srep { } else if a_srep == b_srep {
return Result::Equal; Result::Equal
} else { } else {
return Result::Greater; Result::Greater
}
} }
} }

View File

@@ -1,3 +1,7 @@
// The functions are complex with many branches, and explicit
// `return`s makes it clear where function exit points are
#![allow(clippy::needless_return)]
use float::Float; use float::Float;
use int::{CastInto, DInt, HInt, Int}; use int::{CastInto, DInt, HInt, Int};

View File

@@ -181,7 +181,7 @@ where
product_high += product_high & one; product_high += product_high & one;
} }
return F::from_repr(product_high); F::from_repr(product_high)
} }
intrinsics! { intrinsics! {

View File

@@ -1,5 +1,12 @@
// TODO: when `unsafe_block_in_unsafe_fn` is stabilized, remove this // TODO: when `unsafe_block_in_unsafe_fn` is stabilized, remove this
#![allow(unused_unsafe)] #![allow(unused_unsafe)]
// The functions are complex with many branches, and explicit
// `return`s makes it clear where function exit points are
#![allow(clippy::needless_return)]
#![allow(clippy::comparison_chain)]
// Clippy is confused by the complex configuration
#![allow(clippy::if_same_then_else)]
#![allow(clippy::needless_bool)]
//! This `specialized_div_rem` module is originally from version 1.0.0 of the //! This `specialized_div_rem` module is originally from version 1.0.0 of the
//! `specialized-div-rem` crate. Note that `for` loops with ranges are not used in this //! `specialized-div-rem` crate. Note that `for` loops with ranges are not used in this

View File

@@ -17,6 +17,8 @@
// compiler on ABIs and such, so we should be "good enough" for now and changes // compiler on ABIs and such, so we should be "good enough" for now and changes
// to the `u128` ABI will be reflected here. // to the `u128` ABI will be reflected here.
#![allow(improper_ctypes, improper_ctypes_definitions)] #![allow(improper_ctypes, improper_ctypes_definitions)]
// `mem::swap` cannot be used because it may generate references to memcpy in unoptimized code.
#![allow(clippy::manual_swap)]
// We disable #[no_mangle] for tests so that we can verify the test results // We disable #[no_mangle] for tests so that we can verify the test results
// against the native compiler-rt implementations of the builtins. // against the native compiler-rt implementations of the builtins.

View File

@@ -1,3 +1,6 @@
// Trying to satisfy clippy here is hopeless
#![allow(clippy::style)]
#[allow(warnings)] #[allow(warnings)]
#[cfg(target_pointer_width = "16")] #[cfg(target_pointer_width = "16")]
type c_int = i16; type c_int = i16;