From c31d2fda26aaa2c1870db2533be1484fc310a4f8 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Thu, 12 Sep 2024 20:14:55 +0200 Subject: [PATCH] [clippy] stricter lints --- Cargo.toml | 9 +++++++-- src/sieve.rs | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6a04634..a796e60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,12 +5,17 @@ edition = "2021" [dependencies] +[lints.rust] +unsafe_code = "forbid" + [lints.clippy] -pedantic = "warn" +pedantic = { level = "warn", priority = -1 } +todo = "warn" +unwrap_used = "warn" [profile.release] lto = true debug = false strip = true +panic = "unwind" codegen-units = 1 -panic = "unwind" \ No newline at end of file diff --git a/src/sieve.rs b/src/sieve.rs index eabe333..c531cde 100644 --- a/src/sieve.rs +++ b/src/sieve.rs @@ -38,10 +38,10 @@ fn find_next_prime(nr: &mut u64, sieve: &mut [bool]) -> Option { None } +#[allow(clippy::unwrap_used)] fn check_off_multiples_of_nr(nr: u64, sieve: &mut [bool]) { - let nr = usize::try_from(nr).unwrap(); - + sieve .iter_mut() .skip(nr.checked_mul(2).unwrap())