Skip to content

Commit 5e2b3c7

Browse files
committed
Fix all clippy warnings
1 parent 084fbd2 commit 5e2b3c7

File tree

7 files changed

+28
-16
lines changed

7 files changed

+28
-16
lines changed

src/float/add.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ where
137137
a_significand <<= shift;
138138
a_exponent -= shift;
139139
}
140-
} else
141-
/* addition */
142-
{
140+
} else {
141+
// addition
143142
a_significand += b_significand;
144143

145144
// If the addition carried up, we need to right-shift the result and

src/float/cmp.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,22 @@ fn cmp<F: Float>(a: F, b: F) -> Result {
6363
// a and b as signed integers as we would with a fp_ting-point compare.
6464
if a_srep & b_srep >= szero {
6565
if a_srep < b_srep {
66-
return Result::Less;
66+
Result::Less
6767
} else if a_srep == b_srep {
68-
return Result::Equal;
68+
Result::Equal
6969
} else {
70-
return Result::Greater;
70+
Result::Greater
7171
}
72-
}
7372
// Otherwise, both are negative, so we need to flip the sense of the
7473
// comparison to get the correct result. (This assumes a twos- or ones-
7574
// complement integer representation; if integers are represented in a
7675
// sign-magnitude representation, then this flip is incorrect).
77-
else {
78-
if a_srep > b_srep {
79-
return Result::Less;
80-
} else if a_srep == b_srep {
81-
return Result::Equal;
82-
} else {
83-
return Result::Greater;
84-
}
76+
} else if a_srep > b_srep {
77+
Result::Less
78+
} else if a_srep == b_srep {
79+
Result::Equal
80+
} else {
81+
Result::Greater
8582
}
8683
}
8784

src/float/div.rs

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

src/float/mul.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ where
181181
product_high += product_high & one;
182182
}
183183

184-
return F::from_repr(product_high);
184+
F::from_repr(product_high)
185185
}
186186

187187
intrinsics! {

src/int/specialized_div_rem/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
// TODO: when `unsafe_block_in_unsafe_fn` is stabilized, remove this
22
#![allow(unused_unsafe)]
3+
// The functions are complex with many branches, and explicit
4+
// `return`s makes it clear where function exit points are
5+
#![allow(clippy::needless_return)]
6+
#![allow(clippy::comparison_chain)]
7+
// Clippy is confused by the complex configuration
8+
#![allow(clippy::if_same_then_else)]
9+
#![allow(clippy::needless_bool)]
310

411
//! This `specialized_div_rem` module is originally from version 1.0.0 of the
512
//! `specialized-div-rem` crate. Note that `for` loops with ranges are not used in this

src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
// compiler on ABIs and such, so we should be "good enough" for now and changes
1818
// to the `u128` ABI will be reflected here.
1919
#![allow(improper_ctypes, improper_ctypes_definitions)]
20+
// `mem::swap` cannot be used because it may generate references to memcpy in unoptimized code.
21+
#![allow(clippy::manual_swap)]
2022

2123
// We disable #[no_mangle] for tests so that we can verify the test results
2224
// against the native compiler-rt implementations of the builtins.

src/mem/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Trying to satisfy clippy here is hopeless
2+
#![allow(clippy::style)]
3+
14
#[allow(warnings)]
25
#[cfg(target_pointer_width = "16")]
36
type c_int = i16;

0 commit comments

Comments
 (0)