rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/

Results 741 rust-clippy issues
Sort by recently updated
recently updated
newest added

### Summary The duplicated_attributes lint is being tripped in cases where there are two different allow attributes that share the same text in their reason field. I suspect this is...

C-bug

### Summary Running `cargo clippy` on https://github.com/jasondyoungberg/my-os/tree/b1875e12124b634e9cb90b9d5cce4bb8b327826d causes an error [rustc-ice-2024-05-25T15_13_29-5792.txt](https://github.com/rust-lang/rust-clippy/files/15444030/rustc-ice-2024-05-25T15_13_29-5792.txt) ### Version ```text rustc 1.80.0-nightly (36153f1a4 2024-05-24) binary: rustc commit-hash: 36153f1a4e3162f0a143c7b3e468ecb3beb0008e commit-date: 2024-05-24 host: x86_64-pc-windows-msvc release: 1.80.0-nightly LLVM version:...

C-bug
I-ICE

### What it does warn if an item is annotated with `pub(crate)` in the root module of a crate. this would also apply to `use` items. ### Advantage the default...

A-lint

I tried this code: ```rust #[deny(clippy::pedantic)] pub async fn doesnt_work() { use std::collections::HashSet; use std::sync::Mutex; use std::time::Duration; let lock: Mutex = Mutex::new(HashSet::new()); let mut set = lock.lock().unwrap(); set.insert(0); drop(set); tokio::time::sleep(Duration::from_secs(1)).await;...

C-bug
I-false-positive

### Summary `unnecessary_cast` appears to trigger for a parameter, but not for a local. ### Lint Name `unnecessary_cast` ### Reproducer I tried this code: ```rust fn g() -> i16 {...

C-bug
I-false-negative

### Summary `unnecessary_cast`'s does not cover some cases around `core::ffi::c_*` types that it could. ### Lint Name `unnecessary_cast` ### Reproducer I tried this code: ```rust let x = 42; let...

C-bug
I-false-negative

### What it does With the introduction of `#[expect]` in [1.81.0](https://releases.rs/docs/1.81.0/), it is now possible to ensure that lint is actually relevant - i.e. there is no "allow" that does...

A-lint

### Summary Clippy only warns about parameters of type `&mut Vec` being replaceable by `&mut [T]` if none of the `Vec` APIs are used. For example, you can't use `&mut...

C-bug
I-false-positive

### Summary The `single_range_in_vec_init` warning seems a bit overly cautious, if the type resulting from an invocation of a `vec!` macro is already known "from the outside", e.g. via a...

C-bug
I-false-positive

### What it does Somehow I always want to use `filter_map` with `Option`, and I always forget that it's equivalent to `Option::and_then`, so I end up doing this contrived way...

A-lint