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

### What it does Suggests using the more-scoped `cast` methods https://doc.rust-lang.org/std/primitive.pointer.html#method.cast https://doc.rust-lang.org/std/primitive.pointer.html#method.cast-1 for pointer casting instead of the more-general `as`. ### Categories (optional) - Kind: style (One could argue that...

A-lint

### What it does If a non-`unsafe` generic function containing `unsafe` block uses an operator that is implemented by the caller (via `core::ops::*`) the lint warns that the operator may...

A-lint

fix #8151 improve [`almost_swapped`] to also detects code using let statements like ```rust let b = 1; let a = b; let b = a; let mut b = 1;...

S-waiting-on-author

### Summary When UFCS is used - `std::io::Read::read()` or `std::io::Write::write()` instead of a method call the lint doesn't fire even though it should for exactly the same reasons it fires...

C-bug
I-false-negative

### What it does It happened to me a few times that I was copy-pasting a method to make some light changes. I then renamed the method in the pasted...

A-lint

The reason why `Drop` is a trait is because adding a `drop` method to a type is similar to implementing a trait on it. Other than that, `Drop` does not...

C-enhancement
A-documentation

It's possible that this will cause partial write (depending on what `W` is), which may not be intended: ```rust use std::io; fn write_foo(w: &mut W) -> io::Result { w.write(b"foo")?; Ok(())...

E-hard
T-middle
C-enhancement

`unnecessary_unwrap` recommends that `foo.is_some()` in a conditional followed by `foo.unwrap()` should be replaced by an `if let`. That is usually good advice, however, if the `is_some` is just *part* of...

C-enhancement
L-suggestion

Lint name: manual_flatten I tried this code: ```rust struct Test { a: Option, b: Option, } fn main() { let t = Test { a: Some(1), b: Some(2), }; for...

C-bug
good-first-issue
I-suggestion-causes-error
I-false-positive

### Summary `needless_collect` doesn't consider if the iterator is borrowing values that are moved between the `collect` call and where the collected values are used. ### Lint Name needless_collect ###...

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