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/
### Summary this is a reprisal of #6323. In #6323 the recommendation is to use #[non_exhaustive], but that leads to `error[E0639]: cannot create non-exhaustive struct using struct expression` Leaving users...
*Please write a short comment explaining your change (or "none" for internal only changes)* fix #11399 changelog: [`needless_range_loop`]: Fix the FP warning when the index-var is used in another "field"...
### Summary `unnecessary_struct_initialization` triggers in proc-macros of third-party crates. ### Lint Name unnecessary_struct_initialization ### Reproducer I tried this code: Using [`bevy_ecs_ldtk`](https://crates.io/crates/bevy_ecs_ldtk) v0.9.0. ```rust #[derive(Default, LdtkIntCell)] struct Test { test: i32,...
### Summary `cast_lossless` does not effect on conversion of 8 or 16 bit integer to `isize/usize`. ### Lint Name cast_lossless ### Reproducer I tried this code: ```rust fn main() {...
### Summary Clippy tends to expand types when suggesting to e.g. annotate `std::mem::transmute`, however the original type could be different based on architecture, like `c_char`, thus such suggestions are not...
changelog: [`modulo_one`]: (docs) Clarify that it only applies to integers This might be nitpicky, but it's more technically correct. It also helps if a user skims through the docs, because...
### Summary I noticed this surprising code because I am working on removing `PREC_POSTFIX` from `rustc_ast`. https://github.com/rust-lang/rust-clippy/blob/32374a196dad3965342e29ca69a59e03efed6271/clippy_lints/src/dereference.rs#L1157-L1164 The point of the above condition is to distinguish between 2 cases: ```rust...
### What it does Warn when the first paragraph of a docstring is overly long. `cargo doc` will show the first paragraph of the doscstring in the summary page on...
### What it does Checks for more manual reimplementations of various integer operations that are available as methods. (This can, and probably should, be separated into different lints.) An existing...
More tender love and polish for the documentation and suggestion texts: adding formatting, links, full stops, tweaking wording for readability, changing 'which' to 'that' where appropriate, and other standard copyediting...