diff --git a/Cargo.toml b/Cargo.toml index 9848e15e9ff..84f241ac384 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -166,6 +166,7 @@ unwrap_used = { level = "allow", priority = 1 } use_debug = { level = "allow", priority = 1 } used_underscore_items = { level = "allow", priority = 1 } wildcard_enum_match_arm = { level = "allow", priority = 1 } +needless_for_each = { level = "allow", priority = 1 } # style-lints: doc_lazy_continuation = { level = "allow", priority = 1 } doc_overindented_list_items = { level = "allow", priority = 1 } diff --git a/src/bit_manipulation/binary_count_trailing_zeros.rs b/src/bit_manipulation/binary_count_trailing_zeros.rs index 9950375ddf9..5e6bd33ff3d 100644 --- a/src/bit_manipulation/binary_count_trailing_zeros.rs +++ b/src/bit_manipulation/binary_count_trailing_zeros.rs @@ -50,7 +50,7 @@ pub fn binary_count_trailing_zeros_bitwise(num: u64) -> u32 { } let rightmost_set_bit = num & (num.wrapping_neg()); - 63 - rightmost_set_bit.leading_zeros() + rightmost_set_bit.ilog2() } #[cfg(test)] diff --git a/src/math/prime_check.rs b/src/math/prime_check.rs index f38366c35fc..ad722afbb35 100644 --- a/src/math/prime_check.rs +++ b/src/math/prime_check.rs @@ -1,5 +1,5 @@ pub fn prime_check(num: usize) -> bool { - if (num > 1) & (num < 4) { + if (num > 1) && (num < 4) { return true; } else if (num < 2) || (num.is_multiple_of(2)) { return false;