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

### Description #13098 introduced `@no-rustfix` annotations, that can be removed by changing the suggestion to a multipart suggestion: ```rust //@no-rustfix: need to change the suggestion to a multipart suggestion ```...

good-first-issue
E-medium
C-tracking-issue

### Summary `cast_possible_truncation` can be overly zealous about casting floating point values to integers when said values have just been explicitly "rounded" in the code, so that their values would...

C-bug
I-false-positive

I tried this code: ```rust // in main.rs #![warn(clippy::all, clippy::pedantic)] mod foo; fn main() { foo::foo(); } //in foo.rs #![allow(clippy::single_component_path_imports)] pub fn foo() { usable!(); } macro_rules! usable { ()...

C-bug

One of the subtle aspects of `*ptr = val` where `ptr` is a raw pointer is that this will drop the old contents stored behind that pointer. On the one...

A-lint
L-correctness

changelog: [`use_self`] Skip if inside macro expansions of a `impl Self` block Fixes #13092. r? Alexendoo

S-waiting-on-review

### What it does Detect `assert!(a == b)` and `assert!(a != b)` and suggest using `assert_eq!` or `assert_ne!` respectively. Should probably apply to `debug_assert!` as well. ### Advantage - The...

A-lint

close https://github.com/rust-lang/rust-clippy/issues/13242 This PR fixes the issue where errors from map_unwrap_or were only partially displayed. When the error spans multiple lines, it needs to be shown in a block format....

S-waiting-on-review

### Summary In stable (1.79.0), `unnecessary_lazy_evaluations` does not trigger when the value of the closure is a constant error variant in an enum that derives `thiserror::Error`. - This was emitting...

C-bug
I-false-negative

### Summary Here is a playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=e4fad507e221cf2e8540575031233165 The suggestion leads to broken code which does not compile: ``` error[E0594]: cannot assign to `a.a`, which is behind a `&` reference...

C-bug
I-suggestion-causes-error
I-false-positive

### Summary For `unsafe {}` blocks it matters when they're executed, even if they're cheap. ### Lint Name unnecessary_lazy_evaluations ### Reproducer I tried this code: ```rust is_safe_to_access.then_some(|| unsafe { &a_union.field...

C-bug
I-false-positive