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 {
return Result::Equal;
} else {
return Result::Greater;
}
} else if a_srep > b_srep {
Result::Less
} else if a_srep == b_srep {
Result::Equal
} else {
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! {