rust-clippy
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/
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.
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).
### 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...
### 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,...
### 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...
### 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...
**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...
### 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...
### 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();...