diff --git a/members/matchmatchmatch/src/main.rs b/members/matchmatchmatch/src/main.rs index 9f87e60..a5382d3 100644 --- a/members/matchmatchmatch/src/main.rs +++ b/members/matchmatchmatch/src/main.rs @@ -291,7 +291,6 @@ fn main() { } { Some(inner) => { println!("{:?}", inner); - return; } None => unreachable!(), } diff --git a/members/revsqrt/benches/rsqrt-bench.rs b/members/revsqrt/benches/rsqrt-bench.rs index 5fa3e1c..8e52345 100644 --- a/members/revsqrt/benches/rsqrt-bench.rs +++ b/members/revsqrt/benches/rsqrt-bench.rs @@ -2,8 +2,8 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Through use revsqrt::{fast_inverse_sqrt, regular_inverse_sqrt}; const SIZE: f32 = 1337.1337; -const FCONST: f32 = 1024.12481224; -const FCONST1: f32 = 4025.724812234; +const FCONST: f32 = 1_024.124_8; +const FCONST1: f32 = 4_025.724_9; pub fn single_input(c: &mut Criterion) { c.bench_with_input(BenchmarkId::new("regular rsqrt", SIZE), &SIZE, |b, &s| { diff --git a/members/revsqrt/tests/basic-revsqrt.rs b/members/revsqrt/tests/basic-revsqrt.rs index ae3522f..6226282 100644 --- a/members/revsqrt/tests/basic-revsqrt.rs +++ b/members/revsqrt/tests/basic-revsqrt.rs @@ -1,8 +1,8 @@ use std::iter::zip; -use revsqrt; -use rand; + + // is n about the same as m? // This is actually not so easy! How do you measure "about same"ness? @@ -34,14 +34,14 @@ fn test_calc_regular_rsqrt() { #[test] fn test_calc_specific_fast_rsqrt() { - let params: &[f32] = &[1.0, 1.1, 100.0, 1337.0, 123.45678900, 1337.1337]; + let params: &[f32] = &[1.0, 1.1, 100.0, 1337.0, 123.456_79, 1337.1337]; let results: &[f32] = &[ 1.0, - 0.9534625892455922, + 0.953_462_6, 0.1, - 0.02734854943722097, - 0.0900000004095, - 0.027347182112297627, + 0.027_348_55, + 0.09, + 0.027_347_183, ]; for (n, m) in zip(params, results) { assert!(about_same(revsqrt::fast_inverse_sqrt(*n), *m)) @@ -50,20 +50,21 @@ fn test_calc_specific_fast_rsqrt() { #[test] fn test_calc_specific_reqular_rsqrt() { - let params: &[f32] = &[1.0, 1.1, 100.0, 1337.0, 123.45678900, 1337.1337]; + let params: &[f32] = &[1.0, 1.1, 100.0, 1337.0, 123.456_79, 1337.1337]; let results: &[f32] = &[ 1.0, - 0.9534625892455922, + 0.953_462_6, 0.1, - 0.02734854943722097, - 0.0900000004095, - 0.027347182112297627, + 0.027_348_55, + 0.09, + 0.027_347_183, ]; for (n, m) in zip(params, results) { assert_eq!(revsqrt::regular_inverse_sqrt(*n), *m) } } +#[allow(clippy::assertions_on_constants)] #[test] #[ignore] // this test confuses the CI fn test_fail() { diff --git a/members/revsqrt/tests/revsqrt.rs b/members/revsqrt/tests/revsqrt.rs index f7e2260..6e96167 100644 --- a/members/revsqrt/tests/revsqrt.rs +++ b/members/revsqrt/tests/revsqrt.rs @@ -1,9 +1,9 @@ use std::iter::zip; -use revsqrt; + use cucumber::{gherkin::Step, given, then, when, World}; -use rand; + /// stores the current information for each scenario #[derive(Debug, Default, World)] diff --git a/members/serde-json-demo/src/main.rs b/members/serde-json-demo/src/main.rs index 22ff1ab..930beef 100644 --- a/members/serde-json-demo/src/main.rs +++ b/members/serde-json-demo/src/main.rs @@ -1,7 +1,6 @@ -use anyhow; -use chrono; +#![allow(clippy::disallowed_names)] + use serde::{Deserialize, Serialize}; -use serde_json; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] #[serde(rename_all = "UPPERCASE")] diff --git a/members/shortc/src/main.rs b/members/shortc/src/main.rs index 4da3f9b..69a259c 100644 --- a/members/shortc/src/main.rs +++ b/members/shortc/src/main.rs @@ -6,17 +6,17 @@ use std::{ // This is just a very simple tcp server/client that connects to itself -const ADDR: &'static str = "127.0.0.1:9911"; +const ADDR: &str = "127.0.0.1:9911"; fn main() -> Result<()> { - let mut listen = net::TcpListener::bind(ADDR)?; + let listen = net::TcpListener::bind(ADDR)?; let mut client = net::TcpStream::connect(ADDR)?; - let mut sink = io::sink(); + let _sink = io::sink(); client.write_all(b"foo")?; let mut com = listen.accept()?; com.0.write_all(b"bak")?; - let mut buf = [0;3]; - client.read(&mut buf)?; + let mut buf = [0; 3]; + let _ = client.read(&mut buf)?; println!("{buf:x?}"); Ok(()) } diff --git a/members/socker/src/pool.rs b/members/socker/src/pool.rs index b56f534..e4f5cc6 100644 --- a/members/socker/src/pool.rs +++ b/members/socker/src/pool.rs @@ -3,6 +3,7 @@ use std::{ thread, }; +#[allow(dead_code)] struct WorkerThread { handle: thread::JoinHandle<()>, id: usize, @@ -24,6 +25,7 @@ impl WorkerThread { /// Shares tasks over multiple worker threads pub struct ThreadPool { /// executes tasks assigned by the instructor + #[allow(dead_code)] workers: Vec, /// sends instructions to the workers sender: mpsc::Sender, @@ -41,8 +43,8 @@ impl ThreadPool { /// /// The `new` function will panic if the size is zero. pub fn build(size: usize) -> Result { - if !(size > 0) { - return Err(format!("cannot build a thread pool with size 0!")); + if size == 0 { + return Err("cannot build a thread pool with size 0!".to_string()); } let (sender, receiver) = mpsc::channel(); let receiver = Arc::new(Mutex::new(receiver)); diff --git a/members/tokio-send-sync/src/main.rs b/members/tokio-send-sync/src/main.rs index 6ab531a..e568a62 100644 --- a/members/tokio-send-sync/src/main.rs +++ b/members/tokio-send-sync/src/main.rs @@ -12,7 +12,7 @@ async fn foo(t: TestType) -> Result { #[tokio::main()] async fn main() { let testdata: TestType = 1337; - let arcmut = Arc::new(Mutex::new(testdata)); + let _arcmut = Arc::new(Mutex::new(testdata)); tokio::spawn(async move { let a = foo(testdata).await; a.unwrap().accept().await diff --git a/members/tokryon/src/main.rs b/members/tokryon/src/main.rs index c0008b4..a9770db 100644 --- a/members/tokryon/src/main.rs +++ b/members/tokryon/src/main.rs @@ -43,6 +43,7 @@ fn status(start: &Instant, info: (u128, usize), separate: usize) -> bool { eq } +#[allow(clippy::uninit_vec)] #[tokio::main] async fn main() { // Lets say that we want to add many numbers FAST diff --git a/src/main.rs b/src/main.rs index 9281f5c..6990258 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_names)] fn main() { println!( "SUCCESS!!!