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 I tried using the new clippy lint `allow_attributes` on one of my projects and found many warnings for structs deriving `bytemuck::Pod`. I am using [bytemuck](https://crates.io/crates/bytemuck) and checking the...

C-bug
I-false-positive

### Description Applying fix on this situation: ```rs fn f(v: Vec) { let mut i = 0; for e in &v { // consider using: `for (i, e) in v.iter().enumerate()`...

I-suggestion-causes-error

Closes #13552 changelog: none

S-waiting-on-review

This is currently draft as built on-top of #13557. Closes #12290. This is implemented by inspecting rustc's `NeverToAny` type adjustments, meaning we do not have to solve the halting problem...

S-waiting-on-review

### What it does Suggest to replace `if xxx { Some(yyy) } else { None }` with `(xxx).then(|| yyy)`, it is simpler and cleaner. Bonus point if the condition is...

A-lint

### What it does Consider the following code piece: ```rust ... #[test] fn test_with_silent_fail() { let result = ...; if result.is_err() { eprintln!("failed to do something"); } } ``` This...

A-lint

### Summary It seems that `needless_match` can fire incorrectly with multiple `if let` blocks chained together. ### Lint Name clippy::needless_match ### Reproducer I tried this code: ```rust pub fn color_text_to_rgb_tuple(text:...

C-bug
I-false-positive

With this change we no longer require doc comments for `const _: ()` items as well as nested items in functions or other bodies. In both of those cases, rustdoc...

S-waiting-on-review

Fixes #13568 Follow up to #13359, I didn't catch that it swapped the `strip_prefix` out for a `trim` but they aren't interchangeable here changelog: none

S-waiting-on-review

Close #13106 Considered case was described [here](https://github.com/rust-lang/rust-clippy/pull/13114#issuecomment-2266629991) changelog [`const_is_empty`]: skip const_is_empty for inline const assertions

S-waiting-on-review