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_exponent -= shift;
}
} else
/* addition */
{
} else {
// addition
a_significand += b_significand;
// 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.
if a_srep & b_srep >= szero {
if a_srep < b_srep {
return Result::Less;
Result::Less
} else if a_srep == b_srep {
return Result::Equal;
Result::Equal
} else {
return Result::Greater;
}
Result::Greater
}
// 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-
// complement integer representation; if integers are represented in a
// sign-magnitude representation, then this flip is incorrect).
else {
if a_srep > b_srep {
return Result::Less;
} else if a_srep > b_srep {
Result::Less
} else if a_srep == b_srep {
return Result::Equal;
Result::Equal
} 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 int::{CastInto, DInt, HInt, Int};

View File

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

View File

@@ -1,5 +1,12 @@
// TODO: when `unsafe_block_in_unsafe_fn` is stabilized, remove this
#![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
//! `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
// to the `u128` ABI will be reflected here.
#![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
// 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)]
#[cfg(target_pointer_width = "16")]
type c_int = i16;