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/
Fixes https://github.com/rust-lang/rust-clippy/issues/12163 I decided to initially make this a restriction lint because it felt a bit niche and opinionated to be a warn-by-default style lint. It may be appropriate as...
### Summary This is the same as (now fixed) https://github.com/rust-lang/rust-clippy/issues/12564, but now the lint is `manual_unwrap_or` instead of `manual_unwrap_or_default`. There is a false positive; cargo clippy --fix fails ### Lint...
Back in Rust 1.60.0 we added `-Wclippy::dbg_macro` to the Linux kernel compilation flags, which worked great with our custom `dbg!` macro (essentially the `std` one but calling the kernel printing...
### Summary The `tabs_in_doc_comments` complains about tab-indented doctests. Running `cargo doc` generates nice-looking and correctly-indented documentation when using tabs in this way, so I see no reason for Clippy to...
### What it does Tracks the creation of null pointers with `std::ptr::{null, null_mut}`, and any binding that holds them that are *never* touched until they are dereferenced. When such a...
### Summary There are many valid reasons to work on a mutable slice of mutable references `&mut [&mut Foo]`. For example, if the `Foo`s are large and you temporarily want...
### What it does [`NonZero`](https://doc.rust-lang.org/std/num/struct.NonZero.html) stabilized with Rust 1.79.0. This allows [`NonZeroI32`](https://doc.rust-lang.org/std/num/type.NonZeroI32.html) to be written as `NonZero`. ### Advantage - More readable. - Reduce imports. - Can specify aliases for...
fixes #12978 changelog: [`and_then_then_some`]: added
### Summary ```rust fn a() { let x = 1 else { return }; //~ WARN irrefutable `let...else` pattern // Multiline else blocks should not get printed let x =...
Closes https://github.com/rust-lang/rust-clippy/issues/10118 This lint checks `map_or` method calls to check if they can be consolidated down to something simpler and/or more readable. For example, the code ```rs let x =...