From 6ce07347778b2de937be1806e59147de42c107e6 Mon Sep 17 00:00:00 2001 From: vil02 <65706193+vil02@users.noreply.github.com> Date: Thu, 8 Oct 2026 17:47:43 +0200 Subject: [PATCH] chore: resolve and suppress new clippy warnings --- Cargo.toml | 2 ++ src/dynamic_programming/fibonacci.rs | 2 +- src/machine_learning/support_vector_classifier.rs | 1 - src/math/miller_rabin.rs | 3 +-- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d524d8ba5d1..9d30e5ee0cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -169,6 +169,8 @@ wildcard_enum_match_arm = { level = "allow", priority = 1 } needless_for_each = { level = "allow", priority = 1 } inline_modules = { level = "allow", priority = 1 } inline_trait_bounds = { level = "allow", priority = 1 } +definition_in_module_root = { level = "allow", priority = 1 } +rest_pattern_accessible_field = { 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/dynamic_programming/fibonacci.rs b/src/dynamic_programming/fibonacci.rs index f1a55ce77f1..cf5fbbafeea 100644 --- a/src/dynamic_programming/fibonacci.rs +++ b/src/dynamic_programming/fibonacci.rs @@ -193,7 +193,7 @@ pub fn binary_lifting_fibonacci(n: u32) -> u128 { // the state always stores F(k), F(k+1) for some k, initially F(0), F(1) let mut state = (0u128, 1u128); - for i in (0..u32::BITS - n.leading_zeros()).rev() { + for i in (0..n.bit_width()).rev() { // compute F(2k), F(2k+1) from F(k), F(k+1) state = ( state.0 * (2 * state.1 - state.0), diff --git a/src/machine_learning/support_vector_classifier.rs b/src/machine_learning/support_vector_classifier.rs index 0f144de4e4a..d5122e4e03e 100644 --- a/src/machine_learning/support_vector_classifier.rs +++ b/src/machine_learning/support_vector_classifier.rs @@ -24,7 +24,6 @@ //! ``` use ndarray::{Array1, Array2}; -use std::f64; /// Kernel types supported by the SVC #[derive(Debug, Clone)] diff --git a/src/math/miller_rabin.rs b/src/math/miller_rabin.rs index dbeeac5acbd..1d5af62ec62 100644 --- a/src/math/miller_rabin.rs +++ b/src/math/miller_rabin.rs @@ -72,9 +72,8 @@ pub fn big_miller_rabin(number_ref: &BigUint, bases: &[u64]) -> u64 { panic!("0 is invalid input for Miller-Rabin. 0 is not prime by definition, but has no witness"); } else if number.eq(&BigUint::from(2u32)) || number.eq(&BigUint::from(3u32)) { return 0; - } else { - return number.to_u64().unwrap(); } + return number.to_u64().unwrap(); } if let Some(num) = number.to_u64() {