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 481 rust-clippy issues
Sort by recently updated
recently updated
newest added

Closes #9164 changelog: [`match_like_matches_macro`] is ignored when there is some comment inside the match block. Also add `span_contains_comment` util to check if given span contains comments.

S-waiting-on-review

Just noticed that when refactoring. We could warn when making an iterator [peekable](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.peekable), but never actually peeking it(/returning it/passing it to a function).

E-medium
A-lint

### Summary The code below triggers `clone_double_ref`, which makes Clippy state it can not compile. The compiler, however does not complain and successfully builds the program - some of Clippy's...

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

### Summary The lint says that the function below could be made into a `const fn`. Following this suggestion results in a compiler error, which points at x and says,...

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

### What it does Adding to a collection and never using it is pointless and might indicate that the developer forgot to do something with the collection. Currently this does...

A-lint

### Summary `int_plus_one` suggestions prevent overflows from happening because it removes a potential case where we could run into `T::max() + 1` ### Reproducer I tried this code: ```rust fn...

C-bug

**UPDATE** Turns out this is not a bug but missing feature and unclear documentation, so converting to a docs improvement ticket. Please clarify what lints/features are available in `clippy.toml`, and...

C-bug

Fix #9256 changelog: none

S-waiting-on-review

### What it does The lint suggests to replace an allocated vec![] with a slice. In test blocks I see lot of vecs that aren't necessary. ### Lint Name use_slice_or_array...

A-lint

### What it does Given a slice like ```rust let x: &[i32] = &[1, 2, 3, 4, ..]; ``` When users write something like ```rust let y: Box = x.iter().copied().collect();...

A-lint