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

### Summary ```rust use std::mem::forget; #[allow(dead_code)] fn test_generic_fn_forget(val: T) { forget(&val); forget(val); } ``` => ``` warning: this could be a `const fn` --> a.rs:5:2 | 5 | / fn...

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

### Summary . ### Reproducer I tried this code: ```rust #![recursion_limit = "10"] macro_rules! link { ($outer:ident, $inner:ident) => { struct $outer($inner); impl $outer { fn new() -> $outer {...

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

### Summary . ### Reproducer I tried this code: ```rust use std::cell::Cell; const NONE_CELL_STRING: Option = None; fn a() { // clippy suggests this to be const let _: &'static...

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

### Summary ```rust pub fn main() {} pub struct S24 { a: i8, b: i8, c: i8, } // CHECK: i24 @struct_24_bits(i24 #[no_mangle] pub extern "sysv64" fn struct_24_bits(a: S24) ->...

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

### Summary ```rust #![feature(type_alias_impl_trait)] type Foo4 = impl Debug; fn define4(_: Foo4) { let y: Foo4 = 42; } ``` => ``` warning: this could be a `const fn` -->...

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

### Summary ```rust #[no_mangle] const extern "C-unwind" fn unwind() { // clippy suggests: // const extern "C-unwind" fn unwind() { // but this requires the #![feature(const_extern_fn)] gate panic!(); } fn...

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

### Description slightly amused: ```rust #[derive(Eq, PartialEq)] pub struct Data([u8; 4]); const DATA: Data = Data([1, 2, 3, 4]); fn main() { match DATA { DATA => (), _ =>...

L-suggestion
I-suggestion-causes-error

``` changelog: [`doc_markdown`]: correctly detect backslash-escaped `` ` `` ```

S-waiting-on-review

### Summary There is a pattern that does not work even though needless_return is enabled. [playground is here](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9f84d1d415ac46d0e0fdb123b4a46462). ### Lint Name needless_return ### Reproducer I tried this code: ```rust #![warn(clippy::needless_return)]...

C-bug
I-false-negative

Fixes #10070. It can serve as base if we want to add equivalent checks for other arithmetic operations. Also one important note: when writing this lint, I realized that I...

S-final-comment-period