Added clippy::version attribute to all normal lints

So, some context for this, well, more a story. I'm not used to scripting, I've never really scripted anything, even if it's a valuable skill. I just never really needed it. Now, `@flip1995` correctly suggested using a script for this in `rust-clippy#7813`...

And I decided to write a script using nushell because why not? This was a mistake... I spend way more time on this than I would like to admit. It has definitely been more than 4 hours. It shouldn't take that long, but me being new to scripting and nushell just wasn't a good mixture... Anyway, here is the script that creates another script which adds the versions. Fun...

Just execute this on the `gh-pages` branch and the resulting `replacer.sh` in `clippy_lints` and it should all work.

```nu
mv v0.0.212 rust-1.00.0;
mv beta rust-1.57.0;
mv master rust-1.58.0;

let paths = (open ./rust-1.58.0/lints.json | select id id_span | flatten | select id path);
let versions = (
    ls | where name =~ "rust-" | select name | format {name}/lints.json |
    each { open $it | select id | insert version $it | str substring "5,11" version} |
    group-by id | rotate counter-clockwise id version |
    update version {get version | first 1} | flatten | select id version);
$paths | each { |row|
    let version = ($versions | where id == ($row.id) | format {version})
    let idu = ($row.id | str upcase)
    $"sed -i '0,/($idu),/{s/pub ($idu),/#[clippy::version = "($version)"]\n    pub ($idu),/}' ($row.path)"
} | str collect ";" | str find-replace --all '1.00.0' 'pre 1.29.0' | save "replacer.sh";
```

And this still has some problems, but at this point I just want to be done -.-
This commit is contained in:
xFrednet 2021-10-21 21:06:26 +02:00
parent 63cb41098b
commit d647696c1f
No known key found for this signature in database
GPG Key ID: FCDCBF29AF64D601
235 changed files with 490 additions and 0 deletions

View File

@ -36,6 +36,7 @@ declare_clippy_lint! {
/// if vec.len() <= 0 {} /// if vec.len() <= 0 {}
/// if 100 > i32::MAX {} /// if 100 > i32::MAX {}
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub ABSURD_EXTREME_COMPARISONS, pub ABSURD_EXTREME_COMPARISONS,
correctness, correctness,
"a comparison with a maximum or minimum value that is always true or false" "a comparison with a maximum or minimum value that is always true or false"

View File

@ -33,6 +33,7 @@ declare_clippy_lint! {
/// let x = std::f32::consts::PI; /// let x = std::f32::consts::PI;
/// let y = std::f64::consts::FRAC_1_PI; /// let y = std::f64::consts::FRAC_1_PI;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub APPROX_CONSTANT, pub APPROX_CONSTANT,
correctness, correctness,
"the approximate of a known float constant (in `std::fXX::consts`)" "the approximate of a known float constant (in `std::fXX::consts`)"

View File

@ -25,6 +25,7 @@ declare_clippy_lint! {
/// # let a = 0; /// # let a = 0;
/// a + 1; /// a + 1;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub INTEGER_ARITHMETIC, pub INTEGER_ARITHMETIC,
restriction, restriction,
"any integer arithmetic expression which could overflow or panic" "any integer arithmetic expression which could overflow or panic"
@ -43,6 +44,7 @@ declare_clippy_lint! {
/// # let a = 0.0; /// # let a = 0.0;
/// a + 1.0; /// a + 1.0;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub FLOAT_ARITHMETIC, pub FLOAT_ARITHMETIC,
restriction, restriction,
"any floating-point arithmetic statement" "any floating-point arithmetic statement"

View File

@ -38,6 +38,7 @@ declare_clippy_lint! {
/// f(a.try_into().expect("Unexpected u16 overflow in f")); /// f(a.try_into().expect("Unexpected u16 overflow in f"));
/// ``` /// ```
/// ///
#[clippy::version = "1.41.0"]
pub AS_CONVERSIONS, pub AS_CONVERSIONS,
restriction, restriction,
"using a potentially dangerous silent `as` conversion" "using a potentially dangerous silent `as` conversion"

View File

@ -75,6 +75,7 @@ declare_clippy_lint! {
/// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax)); /// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax));
/// # } /// # }
/// ``` /// ```
#[clippy::version = "1.49.0"]
pub INLINE_ASM_X86_INTEL_SYNTAX, pub INLINE_ASM_X86_INTEL_SYNTAX,
restriction, restriction,
"prefer AT&T x86 assembly syntax" "prefer AT&T x86 assembly syntax"
@ -111,6 +112,7 @@ declare_clippy_lint! {
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr); /// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
/// # } /// # }
/// ``` /// ```
#[clippy::version = "1.49.0"]
pub INLINE_ASM_X86_ATT_SYNTAX, pub INLINE_ASM_X86_ATT_SYNTAX,
restriction, restriction,
"prefer Intel x86 assembly syntax" "prefer Intel x86 assembly syntax"

View File

@ -26,6 +26,7 @@ declare_clippy_lint! {
/// const B: bool = false; /// const B: bool = false;
/// assert!(B) /// assert!(B)
/// ``` /// ```
#[clippy::version = "1.34.0"]
pub ASSERTIONS_ON_CONSTANTS, pub ASSERTIONS_ON_CONSTANTS,
style, style,
"`assert!(true)` / `assert!(false)` will be optimized out by the compiler, and should probably be replaced by a `panic!()` or `unreachable!()`" "`assert!(true)` / `assert!(false)` will be optimized out by the compiler, and should probably be replaced by a `panic!()` or `unreachable!()`"

View File

@ -34,6 +34,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// a += b; /// a += b;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub ASSIGN_OP_PATTERN, pub ASSIGN_OP_PATTERN,
style, style,
"assigning the result of an operation on a variable to that same variable" "assigning the result of an operation on a variable to that same variable"
@ -60,6 +61,7 @@ declare_clippy_lint! {
/// // ... /// // ...
/// a += a + b; /// a += a + b;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub MISREFACTORED_ASSIGN_OP, pub MISREFACTORED_ASSIGN_OP,
suspicious, suspicious,
"having a variable on both sides of an assign op" "having a variable on both sides of an assign op"

View File

@ -34,6 +34,7 @@ declare_clippy_lint! {
/// }; /// };
/// } /// }
/// ``` /// ```
#[clippy::version = "1.48.0"]
pub ASYNC_YIELDS_ASYNC, pub ASYNC_YIELDS_ASYNC,
correctness, correctness,
"async blocks that return a type that can be awaited" "async blocks that return a type that can be awaited"

View File

@ -66,6 +66,7 @@ declare_clippy_lint! {
/// #[inline(always)] /// #[inline(always)]
/// fn not_quite_hot_code(..) { ... } /// fn not_quite_hot_code(..) { ... }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub INLINE_ALWAYS, pub INLINE_ALWAYS,
pedantic, pedantic,
"use of `#[inline(always)]`" "use of `#[inline(always)]`"
@ -100,6 +101,7 @@ declare_clippy_lint! {
/// #[macro_use] /// #[macro_use]
/// extern crate baz; /// extern crate baz;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub USELESS_ATTRIBUTE, pub USELESS_ATTRIBUTE,
correctness, correctness,
"use of lint attributes on `extern crate` items" "use of lint attributes on `extern crate` items"
@ -119,6 +121,7 @@ declare_clippy_lint! {
/// #[deprecated(since = "forever")] /// #[deprecated(since = "forever")]
/// fn something_else() { /* ... */ } /// fn something_else() { /* ... */ }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub DEPRECATED_SEMVER, pub DEPRECATED_SEMVER,
correctness, correctness,
"use of `#[deprecated(since = \"x\")]` where x is not semver" "use of `#[deprecated(since = \"x\")]` where x is not semver"
@ -156,6 +159,7 @@ declare_clippy_lint! {
/// #[allow(dead_code)] /// #[allow(dead_code)]
/// fn this_is_fine_too() { } /// fn this_is_fine_too() { }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EMPTY_LINE_AFTER_OUTER_ATTR, pub EMPTY_LINE_AFTER_OUTER_ATTR,
nursery, nursery,
"empty line after outer attribute" "empty line after outer attribute"
@ -179,6 +183,7 @@ declare_clippy_lint! {
/// ```rust /// ```rust
/// #![deny(clippy::as_conversions)] /// #![deny(clippy::as_conversions)]
/// ``` /// ```
#[clippy::version = "1.47.0"]
pub BLANKET_CLIPPY_RESTRICTION_LINTS, pub BLANKET_CLIPPY_RESTRICTION_LINTS,
suspicious, suspicious,
"enabling the complete restriction group" "enabling the complete restriction group"
@ -210,6 +215,7 @@ declare_clippy_lint! {
/// #[rustfmt::skip] /// #[rustfmt::skip]
/// fn main() { } /// fn main() { }
/// ``` /// ```
#[clippy::version = "1.32.0"]
pub DEPRECATED_CFG_ATTR, pub DEPRECATED_CFG_ATTR,
complexity, complexity,
"usage of `cfg_attr(rustfmt)` instead of tool attributes" "usage of `cfg_attr(rustfmt)` instead of tool attributes"
@ -242,6 +248,7 @@ declare_clippy_lint! {
/// fn conditional() { } /// fn conditional() { }
/// ``` /// ```
/// Check the [Rust Reference](https://doc.rust-lang.org/reference/conditional-compilation.html#target_os) for more details. /// Check the [Rust Reference](https://doc.rust-lang.org/reference/conditional-compilation.html#target_os) for more details.
#[clippy::version = "1.45.0"]
pub MISMATCHED_TARGET_OS, pub MISMATCHED_TARGET_OS,
correctness, correctness,
"usage of `cfg(operating_system)` instead of `cfg(target_os = \"operating_system\")`" "usage of `cfg(operating_system)` instead of `cfg(target_os = \"operating_system\")`"

View File

@ -47,6 +47,7 @@ declare_clippy_lint! {
/// bar.await; /// bar.await;
/// } /// }
/// ``` /// ```
#[clippy::version = "1.45.0"]
pub AWAIT_HOLDING_LOCK, pub AWAIT_HOLDING_LOCK,
pedantic, pedantic,
"Inside an async function, holding a MutexGuard while calling await" "Inside an async function, holding a MutexGuard while calling await"
@ -88,6 +89,7 @@ declare_clippy_lint! {
/// bar.await; /// bar.await;
/// } /// }
/// ``` /// ```
#[clippy::version = "1.49.0"]
pub AWAIT_HOLDING_REFCELL_REF, pub AWAIT_HOLDING_REFCELL_REF,
pedantic, pedantic,
"Inside an async function, holding a RefCell ref while calling await" "Inside an async function, holding a RefCell ref while calling await"

View File

@ -41,6 +41,7 @@ declare_clippy_lint! {
/// # let x = 1; /// # let x = 1;
/// if (x & 1 == 2) { } /// if (x & 1 == 2) { }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub BAD_BIT_MASK, pub BAD_BIT_MASK,
correctness, correctness,
"expressions of the form `_ & mask == select` that will only ever return `true` or `false`" "expressions of the form `_ & mask == select` that will only ever return `true` or `false`"
@ -73,6 +74,7 @@ declare_clippy_lint! {
/// # let x = 1; /// # let x = 1;
/// if (x | 1 > 3) { } /// if (x | 1 > 3) { }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub INEFFECTIVE_BIT_MASK, pub INEFFECTIVE_BIT_MASK,
correctness, correctness,
"expressions where a bit mask will be rendered useless by a comparison, e.g., `(x | 1) > 2`" "expressions where a bit mask will be rendered useless by a comparison, e.g., `(x | 1) > 2`"
@ -95,6 +97,7 @@ declare_clippy_lint! {
/// # let x = 1; /// # let x = 1;
/// if x & 0b1111 == 0 { } /// if x & 0b1111 == 0 { }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub VERBOSE_BIT_MASK, pub VERBOSE_BIT_MASK,
pedantic, pedantic,
"expressions where a bit mask is less readable than the corresponding method call" "expressions where a bit mask is less readable than the corresponding method call"

View File

@ -17,6 +17,7 @@ declare_clippy_lint! {
/// ```rust /// ```rust
/// let foo = 3.14; /// let foo = 3.14;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub BLACKLISTED_NAME, pub BLACKLISTED_NAME,
style, style,
"usage of a blacklisted/placeholder name" "usage of a blacklisted/placeholder name"

View File

@ -41,6 +41,7 @@ declare_clippy_lint! {
/// let res = { let x = somefunc(); x }; /// let res = { let x = somefunc(); x };
/// if res { /* ... */ } /// if res { /* ... */ }
/// ``` /// ```
#[clippy::version = "1.45.0"]
pub BLOCKS_IN_IF_CONDITIONS, pub BLOCKS_IN_IF_CONDITIONS,
style, style,
"useless or complex blocks that can be eliminated in conditions" "useless or complex blocks that can be eliminated in conditions"

View File

@ -23,6 +23,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// assert!(!"a".is_empty()); /// assert!(!"a".is_empty());
/// ``` /// ```
#[clippy::version = "1.53.0"]
pub BOOL_ASSERT_COMPARISON, pub BOOL_ASSERT_COMPARISON,
style, style,
"Using a boolean as comparison value in an assert_* macro when there is no need" "Using a boolean as comparison value in an assert_* macro when there is no need"

View File

@ -31,6 +31,7 @@ declare_clippy_lint! {
/// if a && true // should be: if a /// if a && true // should be: if a
/// if !(a == b) // should be: if a != b /// if !(a == b) // should be: if a != b
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub NONMINIMAL_BOOL, pub NONMINIMAL_BOOL,
complexity, complexity,
"boolean expressions that can be written more concisely" "boolean expressions that can be written more concisely"
@ -52,6 +53,7 @@ declare_clippy_lint! {
/// if a && b || a { ... } /// if a && b || a { ... }
/// ``` /// ```
/// The `b` is unnecessary, the expression is equivalent to `if a`. /// The `b` is unnecessary, the expression is equivalent to `if a`.
#[clippy::version = "pre 1.29.0"]
pub LOGIC_BUG, pub LOGIC_BUG,
correctness, correctness,
"boolean expressions that contain terminals which can be eliminated" "boolean expressions that contain terminals which can be eliminated"

View File

@ -30,6 +30,7 @@ declare_clippy_lint! {
/// # let vec = vec![1_u8]; /// # let vec = vec![1_u8];
/// &vec.iter().filter(|x| **x == 0u8).count(); // use bytecount::count instead /// &vec.iter().filter(|x| **x == 0u8).count(); // use bytecount::count instead
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub NAIVE_BYTECOUNT, pub NAIVE_BYTECOUNT,
pedantic, pedantic,
"use of naive `<slice>.filter(|&x| x == y).count()` to count byte values" "use of naive `<slice>.filter(|&x| x == y).count()` to count byte values"

View File

@ -42,6 +42,7 @@ declare_clippy_lint! {
/// keywords = ["clippy", "lint", "plugin"] /// keywords = ["clippy", "lint", "plugin"]
/// categories = ["development-tools", "development-tools::cargo-plugins"] /// categories = ["development-tools", "development-tools::cargo-plugins"]
/// ``` /// ```
#[clippy::version = "1.32.0"]
pub CARGO_COMMON_METADATA, pub CARGO_COMMON_METADATA,
cargo, cargo,
"common metadata is defined in `Cargo.toml`" "common metadata is defined in `Cargo.toml`"

View File

@ -27,6 +27,7 @@ declare_clippy_lint! {
/// filename.rsplit('.').next().map(|ext| ext.eq_ignore_ascii_case("rs")) == Some(true) /// filename.rsplit('.').next().map(|ext| ext.eq_ignore_ascii_case("rs")) == Some(true)
/// } /// }
/// ``` /// ```
#[clippy::version = "1.51.0"]
pub CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS, pub CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS,
pedantic, pedantic,
"Checks for calls to ends_with with case-sensitive file extensions" "Checks for calls to ends_with with case-sensitive file extensions"

View File

@ -40,6 +40,7 @@ declare_clippy_lint! {
/// let x = u64::MAX; /// let x = u64::MAX;
/// x as f64; /// x as f64;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_PRECISION_LOSS, pub CAST_PRECISION_LOSS,
pedantic, pedantic,
"casts that cause loss of precision, e.g., `x as f32` where `x: u64`" "casts that cause loss of precision, e.g., `x as f32` where `x: u64`"
@ -61,6 +62,7 @@ declare_clippy_lint! {
/// let y: i8 = -1; /// let y: i8 = -1;
/// y as u128; // will return 18446744073709551615 /// y as u128; // will return 18446744073709551615
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_SIGN_LOSS, pub CAST_SIGN_LOSS,
pedantic, pedantic,
"casts from signed types to unsigned types, e.g., `x as u32` where `x: i32`" "casts from signed types to unsigned types, e.g., `x as u32` where `x: i32`"
@ -83,6 +85,7 @@ declare_clippy_lint! {
/// x as u8 /// x as u8
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_POSSIBLE_TRUNCATION, pub CAST_POSSIBLE_TRUNCATION,
pedantic, pedantic,
"casts that may cause truncation of the value, e.g., `x as u8` where `x: u32`, or `x as i32` where `x: f32`" "casts that may cause truncation of the value, e.g., `x as u8` where `x: u32`, or `x as i32` where `x: f32`"
@ -106,6 +109,7 @@ declare_clippy_lint! {
/// ```rust /// ```rust
/// u32::MAX as i32; // will yield a value of `-1` /// u32::MAX as i32; // will yield a value of `-1`
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_POSSIBLE_WRAP, pub CAST_POSSIBLE_WRAP,
pedantic, pedantic,
"casts that may cause wrapping around the value, e.g., `x as i32` where `x: u32` and `x > i32::MAX`" "casts that may cause wrapping around the value, e.g., `x as i32` where `x: u32` and `x > i32::MAX`"
@ -138,6 +142,7 @@ declare_clippy_lint! {
/// u64::from(x) /// u64::from(x)
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_LOSSLESS, pub CAST_LOSSLESS,
pedantic, pedantic,
"casts using `as` that are known to be lossless, e.g., `x as u64` where `x: u8`" "casts using `as` that are known to be lossless, e.g., `x as u64` where `x: u8`"
@ -163,6 +168,7 @@ declare_clippy_lint! {
/// let _ = 2_i32; /// let _ = 2_i32;
/// let _ = 0.5_f32; /// let _ = 0.5_f32;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub UNNECESSARY_CAST, pub UNNECESSARY_CAST,
complexity, complexity,
"cast to the same type, e.g., `x as i32` where `x: i32`" "cast to the same type, e.g., `x as i32` where `x: i32`"
@ -190,6 +196,7 @@ declare_clippy_lint! {
/// (&1u8 as *const u8).cast::<u16>(); /// (&1u8 as *const u8).cast::<u16>();
/// (&mut 1u8 as *mut u8).cast::<u16>(); /// (&mut 1u8 as *mut u8).cast::<u16>();
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_PTR_ALIGNMENT, pub CAST_PTR_ALIGNMENT,
pedantic, pedantic,
"cast from a pointer to a more-strictly-aligned pointer" "cast from a pointer to a more-strictly-aligned pointer"
@ -217,6 +224,7 @@ declare_clippy_lint! {
/// fn fun2() -> i32 { 1 } /// fn fun2() -> i32 { 1 }
/// let a = fun2 as usize; /// let a = fun2 as usize;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub FN_TO_NUMERIC_CAST, pub FN_TO_NUMERIC_CAST,
style, style,
"casting a function pointer to a numeric type other than usize" "casting a function pointer to a numeric type other than usize"
@ -247,6 +255,7 @@ declare_clippy_lint! {
/// let fn_ptr = fn2 as usize; /// let fn_ptr = fn2 as usize;
/// let fn_ptr_truncated = fn_ptr as i32; /// let fn_ptr_truncated = fn_ptr as i32;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub FN_TO_NUMERIC_CAST_WITH_TRUNCATION, pub FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
style, style,
"casting a function pointer to a numeric type not wide enough to store the address" "casting a function pointer to a numeric type not wide enough to store the address"
@ -283,6 +292,7 @@ declare_clippy_lint! {
/// } /// }
/// let _ = fn3 as fn() -> u16; /// let _ = fn3 as fn() -> u16;
/// ``` /// ```
#[clippy::version = "1.58.0"]
pub FN_TO_NUMERIC_CAST_ANY, pub FN_TO_NUMERIC_CAST_ANY,
restriction, restriction,
"casting a function pointer to any integer type" "casting a function pointer to any integer type"
@ -317,6 +327,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "1.33.0"]
pub CAST_REF_TO_MUT, pub CAST_REF_TO_MUT,
correctness, correctness,
"a cast of reference to a mutable pointer" "a cast of reference to a mutable pointer"
@ -344,6 +355,7 @@ declare_clippy_lint! {
/// ```rust,ignore /// ```rust,ignore
/// b'x' /// b'x'
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub CHAR_LIT_AS_U8, pub CHAR_LIT_AS_U8,
complexity, complexity,
"casting a character literal to `u8` truncates" "casting a character literal to `u8` truncates"
@ -372,6 +384,7 @@ declare_clippy_lint! {
/// let _ = ptr.cast::<i32>(); /// let _ = ptr.cast::<i32>();
/// let _ = mut_ptr.cast::<i32>(); /// let _ = mut_ptr.cast::<i32>();
/// ``` /// ```
#[clippy::version = "1.51.0"]
pub PTR_AS_PTR, pub PTR_AS_PTR,
pedantic, pedantic,
"casting using `as` from and to raw pointers that doesn't change its mutability, where `pointer::cast` could take the place of `as`" "casting using `as` from and to raw pointers that doesn't change its mutability, where `pointer::cast` could take the place of `as`"

View File

@ -36,6 +36,7 @@ declare_clippy_lint! {
/// i32::try_from(foo).is_ok() /// i32::try_from(foo).is_ok()
/// # ; /// # ;
/// ``` /// ```
#[clippy::version = "1.37.0"]
pub CHECKED_CONVERSIONS, pub CHECKED_CONVERSIONS,
pedantic, pedantic,
"`try_from` could replace manual bounds checking when casting" "`try_from` could replace manual bounds checking when casting"

View File

@ -27,6 +27,7 @@ declare_clippy_lint! {
/// ///
/// ### Example /// ### Example
/// No. You'll see it when you get the warning. /// No. You'll see it when you get the warning.
#[clippy::version = "1.35.0"]
pub COGNITIVE_COMPLEXITY, pub COGNITIVE_COMPLEXITY,
nursery, nursery,
"functions that should be split up into multiple functions" "functions that should be split up into multiple functions"

View File

@ -47,6 +47,7 @@ declare_clippy_lint! {
/// … /// …
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub COLLAPSIBLE_IF, pub COLLAPSIBLE_IF,
style, style,
"nested `if`s that can be collapsed (e.g., `if x { if y { ... } }`" "nested `if`s that can be collapsed (e.g., `if x { if y { ... } }`"
@ -82,6 +83,7 @@ declare_clippy_lint! {
/// … /// …
/// } /// }
/// ``` /// ```
#[clippy::version = "1.51.0"]
pub COLLAPSIBLE_ELSE_IF, pub COLLAPSIBLE_ELSE_IF,
style, style,
"nested `else`-`if` expressions that can be collapsed (e.g., `else { if x { ... } }`)" "nested `else`-`if` expressions that can be collapsed (e.g., `else { if x { ... } }`)"

View File

@ -41,6 +41,7 @@ declare_clippy_lint! {
/// }; /// };
/// } /// }
/// ``` /// ```
#[clippy::version = "1.50.0"]
pub COLLAPSIBLE_MATCH, pub COLLAPSIBLE_MATCH,
style, style,
"Nested `match` or `if let` expressions where the patterns may be \"collapsed\" together." "Nested `match` or `if let` expressions where the patterns may be \"collapsed\" together."

View File

@ -49,6 +49,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "1.40.0"]
pub COMPARISON_CHAIN, pub COMPARISON_CHAIN,
style, style,
"`if`s that can be rewritten with `match` and `cmp`" "`if`s that can be rewritten with `match` and `cmp`"

View File

@ -41,6 +41,7 @@ declare_clippy_lint! {
/// … /// …
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub IFS_SAME_COND, pub IFS_SAME_COND,
correctness, correctness,
"consecutive `if`s with the same condition" "consecutive `if`s with the same condition"
@ -88,6 +89,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "1.41.0"]
pub SAME_FUNCTIONS_IN_IF_CONDITION, pub SAME_FUNCTIONS_IN_IF_CONDITION,
pedantic, pedantic,
"consecutive `if`s with the same function call" "consecutive `if`s with the same function call"
@ -109,6 +111,7 @@ declare_clippy_lint! {
/// 42 /// 42
/// }; /// };
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub IF_SAME_THEN_ELSE, pub IF_SAME_THEN_ELSE,
correctness, correctness,
"`if` with the same `then` and `else` blocks" "`if` with the same `then` and `else` blocks"
@ -147,6 +150,7 @@ declare_clippy_lint! {
/// 42 /// 42
/// }; /// };
/// ``` /// ```
#[clippy::version = "1.53.0"]
pub BRANCHES_SHARING_CODE, pub BRANCHES_SHARING_CODE,
nursery, nursery,
"`if` statement with shared code in all blocks" "`if` statement with shared code in all blocks"

View File

@ -28,6 +28,7 @@ declare_clippy_lint! {
/// let a: Vec<_> = my_iterator.take(1).collect(); /// let a: Vec<_> = my_iterator.take(1).collect();
/// let b: Vec<_> = my_iterator.collect(); /// let b: Vec<_> = my_iterator.collect();
/// ``` /// ```
#[clippy::version = "1.30.0"]
pub COPY_ITERATOR, pub COPY_ITERATOR,
pedantic, pedantic,
"implementing `Iterator` on a `Copy` type" "implementing `Iterator` on a `Copy` type"

View File

@ -23,6 +23,7 @@ declare_clippy_lint! {
/// ```rust /// ```rust
/// std::fs::create_dir_all("foo"); /// std::fs::create_dir_all("foo");
/// ``` /// ```
#[clippy::version = "1.48.0"]
pub CREATE_DIR, pub CREATE_DIR,
restriction, restriction,
"calling `std::fs::create_dir` instead of `std::fs::create_dir_all`" "calling `std::fs::create_dir` instead of `std::fs::create_dir_all`"

View File

@ -23,6 +23,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// true /// true
/// ``` /// ```
#[clippy::version = "1.34.0"]
pub DBG_MACRO, pub DBG_MACRO,
restriction, restriction,
"`dbg!` macro is intended as a debugging tool" "`dbg!` macro is intended as a debugging tool"

View File

@ -29,6 +29,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// let s = String::default(); /// let s = String::default();
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub DEFAULT_TRAIT_ACCESS, pub DEFAULT_TRAIT_ACCESS,
pedantic, pedantic,
"checks for literal calls to `Default::default()`" "checks for literal calls to `Default::default()`"
@ -62,6 +63,7 @@ declare_clippy_lint! {
/// .. Default::default() /// .. Default::default()
/// }; /// };
/// ``` /// ```
#[clippy::version = "1.49.0"]
pub FIELD_REASSIGN_WITH_DEFAULT, pub FIELD_REASSIGN_WITH_DEFAULT,
style, style,
"binding initialized with Default should have its fields set in the initializer" "binding initialized with Default should have its fields set in the initializer"

View File

@ -46,6 +46,7 @@ declare_clippy_lint! {
/// let i = 10i32; /// let i = 10i32;
/// let f = 1.23f64; /// let f = 1.23f64;
/// ``` /// ```
#[clippy::version = "1.52.0"]
pub DEFAULT_NUMERIC_FALLBACK, pub DEFAULT_NUMERIC_FALLBACK,
restriction, restriction,
"usage of unconstrained numeric literals which may cause default numeric fallback." "usage of unconstrained numeric literals which may cause default numeric fallback."

View File

@ -34,6 +34,7 @@ declare_clippy_lint! {
/// ```rust,ignore /// ```rust,ignore
/// let _ = d.unwrap().deref(); /// let _ = d.unwrap().deref();
/// ``` /// ```
#[clippy::version = "1.44.0"]
pub EXPLICIT_DEREF_METHODS, pub EXPLICIT_DEREF_METHODS,
pedantic, pedantic,
"Explicit use of deref or deref_mut method while not in a method chain." "Explicit use of deref or deref_mut method while not in a method chain."

View File

@ -46,6 +46,7 @@ declare_clippy_lint! {
/// has exactly equal bounds, and therefore this lint is disabled for types with /// has exactly equal bounds, and therefore this lint is disabled for types with
/// generic parameters. /// generic parameters.
/// ///
#[clippy::version = "1.57.0"]
pub DERIVABLE_IMPLS, pub DERIVABLE_IMPLS,
complexity, complexity,
"manual implementation of the `Default` trait which is equal to a derive" "manual implementation of the `Default` trait which is equal to a derive"

View File

@ -38,6 +38,7 @@ declare_clippy_lint! {
/// ... /// ...
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub DERIVE_HASH_XOR_EQ, pub DERIVE_HASH_XOR_EQ,
correctness, correctness,
"deriving `Hash` but implementing `PartialEq` explicitly" "deriving `Hash` but implementing `PartialEq` explicitly"
@ -88,6 +89,7 @@ declare_clippy_lint! {
/// #[derive(Ord, PartialOrd, PartialEq, Eq)] /// #[derive(Ord, PartialOrd, PartialEq, Eq)]
/// struct Foo; /// struct Foo;
/// ``` /// ```
#[clippy::version = "1.47.0"]
pub DERIVE_ORD_XOR_PARTIAL_ORD, pub DERIVE_ORD_XOR_PARTIAL_ORD,
correctness, correctness,
"deriving `Ord` but implementing `PartialOrd` explicitly" "deriving `Ord` but implementing `PartialOrd` explicitly"
@ -114,6 +116,7 @@ declare_clippy_lint! {
/// // .. /// // ..
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EXPL_IMPL_CLONE_ON_COPY, pub EXPL_IMPL_CLONE_ON_COPY,
pedantic, pedantic,
"implementing `Clone` explicitly on `Copy` types" "implementing `Clone` explicitly on `Copy` types"
@ -147,6 +150,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "1.45.0"]
pub UNSAFE_DERIVE_DESERIALIZE, pub UNSAFE_DERIVE_DESERIALIZE,
pedantic, pedantic,
"deriving `serde::Deserialize` on a type that has methods using `unsafe`" "deriving `serde::Deserialize` on a type that has methods using `unsafe`"

View File

@ -47,6 +47,7 @@ declare_clippy_lint! {
/// let mut xs = Vec::new(); // Vec::new is _not_ disallowed in the config. /// let mut xs = Vec::new(); // Vec::new is _not_ disallowed in the config.
/// xs.push(123); // Vec::push is _not_ disallowed in the config. /// xs.push(123); // Vec::push is _not_ disallowed in the config.
/// ``` /// ```
#[clippy::version = "1.49.0"]
pub DISALLOWED_METHOD, pub DISALLOWED_METHOD,
nursery, nursery,
"use of a disallowed method call" "use of a disallowed method call"

View File

@ -38,6 +38,7 @@ declare_clippy_lint! {
/// let zähler = 10; // OK, it's still latin. /// let zähler = 10; // OK, it's still latin.
/// let カウンタ = 10; // Will spawn the lint. /// let カウンタ = 10; // Will spawn the lint.
/// ``` /// ```
#[clippy::version = "1.55.0"]
pub DISALLOWED_SCRIPT_IDENTS, pub DISALLOWED_SCRIPT_IDENTS,
restriction, restriction,
"usage of non-allowed Unicode scripts" "usage of non-allowed Unicode scripts"

View File

@ -42,6 +42,7 @@ declare_clippy_lint! {
/// // A similar type that is allowed by the config /// // A similar type that is allowed by the config
/// use std::collections::HashMap; /// use std::collections::HashMap;
/// ``` /// ```
#[clippy::version = "1.55.0"]
pub DISALLOWED_TYPE, pub DISALLOWED_TYPE,
nursery, nursery,
"use of a disallowed type" "use of a disallowed type"

View File

@ -67,6 +67,7 @@ declare_clippy_lint! {
/// /// [SmallVec]: SmallVec /// /// [SmallVec]: SmallVec
/// fn main() {} /// fn main() {}
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub DOC_MARKDOWN, pub DOC_MARKDOWN,
pedantic, pedantic,
"presence of `_`, `::` or camel-case outside backticks in documentation" "presence of `_`, `::` or camel-case outside backticks in documentation"
@ -101,6 +102,7 @@ declare_clippy_lint! {
/// unimplemented!(); /// unimplemented!();
/// } /// }
/// ``` /// ```
#[clippy::version = "1.39.0"]
pub MISSING_SAFETY_DOC, pub MISSING_SAFETY_DOC,
style, style,
"`pub unsafe fn` without `# Safety` docs" "`pub unsafe fn` without `# Safety` docs"
@ -129,6 +131,7 @@ declare_clippy_lint! {
/// unimplemented!(); /// unimplemented!();
/// } /// }
/// ``` /// ```
#[clippy::version = "1.41.0"]
pub MISSING_ERRORS_DOC, pub MISSING_ERRORS_DOC,
pedantic, pedantic,
"`pub fn` returns `Result` without `# Errors` in doc comment" "`pub fn` returns `Result` without `# Errors` in doc comment"
@ -159,6 +162,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "1.52.0"]
pub MISSING_PANICS_DOC, pub MISSING_PANICS_DOC,
pedantic, pedantic,
"`pub fn` may panic without `# Panics` in doc comment" "`pub fn` may panic without `# Panics` in doc comment"
@ -187,6 +191,7 @@ declare_clippy_lint! {
/// unimplemented!(); /// unimplemented!();
/// } /// }
/// `````` /// ``````
#[clippy::version = "1.40.0"]
pub NEEDLESS_DOCTEST_MAIN, pub NEEDLESS_DOCTEST_MAIN,
style, style,
"presence of `fn main() {` in code examples" "presence of `fn main() {` in code examples"

View File

@ -31,6 +31,7 @@ declare_clippy_lint! {
/// # let y = 2; /// # let y = 2;
/// if x <= y {} /// if x <= y {}
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub DOUBLE_COMPARISONS, pub DOUBLE_COMPARISONS,
complexity, complexity,
"unnecessary double comparisons that can be simplified" "unnecessary double comparisons that can be simplified"

View File

@ -32,6 +32,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// foo(0); /// foo(0);
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub DOUBLE_PARENS, pub DOUBLE_PARENS,
complexity, complexity,
"Warn on unnecessary double parentheses" "Warn on unnecessary double parentheses"

View File

@ -25,6 +25,7 @@ declare_clippy_lint! {
/// // still locked /// // still locked
/// operation_that_requires_mutex_to_be_unlocked(); /// operation_that_requires_mutex_to_be_unlocked();
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub DROP_REF, pub DROP_REF,
correctness, correctness,
"calls to `std::mem::drop` with a reference instead of an owned value" "calls to `std::mem::drop` with a reference instead of an owned value"
@ -46,6 +47,7 @@ declare_clippy_lint! {
/// let x = Box::new(1); /// let x = Box::new(1);
/// std::mem::forget(&x) // Should have been forget(x), x will still be dropped /// std::mem::forget(&x) // Should have been forget(x), x will still be dropped
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub FORGET_REF, pub FORGET_REF,
correctness, correctness,
"calls to `std::mem::forget` with a reference instead of an owned value" "calls to `std::mem::forget` with a reference instead of an owned value"
@ -67,6 +69,7 @@ declare_clippy_lint! {
/// std::mem::drop(x) // A copy of x is passed to the function, leaving the /// std::mem::drop(x) // A copy of x is passed to the function, leaving the
/// // original unaffected /// // original unaffected
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub DROP_COPY, pub DROP_COPY,
correctness, correctness,
"calls to `std::mem::drop` with a value that implements Copy" "calls to `std::mem::drop` with a value that implements Copy"
@ -94,6 +97,7 @@ declare_clippy_lint! {
/// std::mem::forget(x) // A copy of x is passed to the function, leaving the /// std::mem::forget(x) // A copy of x is passed to the function, leaving the
/// // original unaffected /// // original unaffected
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub FORGET_COPY, pub FORGET_COPY,
correctness, correctness,
"calls to `std::mem::forget` with a value that implements Copy" "calls to `std::mem::forget` with a value that implements Copy"

View File

@ -33,6 +33,7 @@ declare_clippy_lint! {
/// let _micros = dur.subsec_micros(); /// let _micros = dur.subsec_micros();
/// let _millis = dur.subsec_millis(); /// let _millis = dur.subsec_millis();
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub DURATION_SUBSEC, pub DURATION_SUBSEC,
complexity, complexity,
"checks for calculation of subsecond microseconds or milliseconds" "checks for calculation of subsecond microseconds or milliseconds"

View File

@ -40,6 +40,7 @@ declare_clippy_lint! {
/// // We don't care about zero. /// // We don't care about zero.
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub ELSE_IF_WITHOUT_ELSE, pub ELSE_IF_WITHOUT_ELSE,
restriction, restriction,
"`if` expression with an `else if`, but without a final `else` branch" "`if` expression with an `else if`, but without a final `else` branch"

View File

@ -34,6 +34,7 @@ declare_clippy_lint! {
/// ///
/// struct Test(!); /// struct Test(!);
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EMPTY_ENUM, pub EMPTY_ENUM,
pedantic, pedantic,
"enum with no variants" "enum with no variants"

View File

@ -54,6 +54,7 @@ declare_clippy_lint! {
/// # let v = 1; /// # let v = 1;
/// map.entry(k).or_insert(v); /// map.entry(k).or_insert(v);
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub MAP_ENTRY, pub MAP_ENTRY,
perf, perf,
"use of `contains_key` followed by `insert` on a `HashMap` or `BTreeMap`" "use of `contains_key` followed by `insert` on a `HashMap` or `BTreeMap`"

View File

@ -28,6 +28,7 @@ declare_clippy_lint! {
/// Y = 0, /// Y = 0,
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub ENUM_CLIKE_UNPORTABLE_VARIANT, pub ENUM_CLIKE_UNPORTABLE_VARIANT,
correctness, correctness,
"C-like enums that are `repr(isize/usize)` and have values that don't fit into an `i32`" "C-like enums that are `repr(isize/usize)` and have values that don't fit into an `i32`"

View File

@ -34,6 +34,7 @@ declare_clippy_lint! {
/// Battenberg, /// Battenberg,
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub ENUM_VARIANT_NAMES, pub ENUM_VARIANT_NAMES,
style, style,
"enums where all variants share a prefix/postfix" "enums where all variants share a prefix/postfix"
@ -59,6 +60,7 @@ declare_clippy_lint! {
/// struct BlackForest; /// struct BlackForest;
/// } /// }
/// ``` /// ```
#[clippy::version = "1.33.0"]
pub MODULE_NAME_REPETITIONS, pub MODULE_NAME_REPETITIONS,
pedantic, pedantic,
"type names prefixed/postfixed with their containing module's name" "type names prefixed/postfixed with their containing module's name"
@ -89,6 +91,7 @@ declare_clippy_lint! {
/// ... /// ...
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub MODULE_INCEPTION, pub MODULE_INCEPTION,
style, style,
"modules that have the same name as their parent module" "modules that have the same name as their parent module"

View File

@ -34,6 +34,7 @@ declare_clippy_lint! {
/// # let b = 4; /// # let b = 4;
/// assert_eq!(a, a); /// assert_eq!(a, a);
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EQ_OP, pub EQ_OP,
correctness, correctness,
"equal operands on both sides of a comparison or bitwise combination (e.g., `x == x`)" "equal operands on both sides of a comparison or bitwise combination (e.g., `x == x`)"
@ -59,6 +60,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// x == *y /// x == *y
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub OP_REF, pub OP_REF,
style, style,
"taking a reference to satisfy the type constraints on `==`" "taking a reference to satisfy the type constraints on `==`"

View File

@ -32,6 +32,7 @@ declare_clippy_lint! {
/// do_thing(); /// do_thing();
/// } /// }
/// ``` /// ```
#[clippy::version = "1.57.0"]
pub EQUATABLE_IF_LET, pub EQUATABLE_IF_LET,
nursery, nursery,
"using pattern matching instead of equality" "using pattern matching instead of equality"

View File

@ -21,6 +21,7 @@ declare_clippy_lint! {
/// 0 * x; /// 0 * x;
/// x & 0; /// x & 0;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub ERASING_OP, pub ERASING_OP,
correctness, correctness,
"using erasing operations, e.g., `x * 0` or `y & 0`" "using erasing operations, e.g., `x * 0` or `y & 0`"

View File

@ -41,6 +41,7 @@ declare_clippy_lint! {
/// foo(x); /// foo(x);
/// println!("{}", x); /// println!("{}", x);
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub BOXED_LOCAL, pub BOXED_LOCAL,
perf, perf,
"using `Box<T>` where unnecessary" "using `Box<T>` where unnecessary"

View File

@ -39,6 +39,7 @@ declare_clippy_lint! {
/// ``` /// ```
/// where `foo(_)` is a plain function that takes the exact argument type of /// where `foo(_)` is a plain function that takes the exact argument type of
/// `x`. /// `x`.
#[clippy::version = "pre 1.29.0"]
pub REDUNDANT_CLOSURE, pub REDUNDANT_CLOSURE,
style, style,
"redundant closures, i.e., `|a| foo(a)` (which can be written as just `foo`)" "redundant closures, i.e., `|a| foo(a)` (which can be written as just `foo`)"
@ -60,6 +61,7 @@ declare_clippy_lint! {
/// ```rust,ignore /// ```rust,ignore
/// Some('a').map(char::to_uppercase); /// Some('a').map(char::to_uppercase);
/// ``` /// ```
#[clippy::version = "1.35.0"]
pub REDUNDANT_CLOSURE_FOR_METHOD_CALLS, pub REDUNDANT_CLOSURE_FOR_METHOD_CALLS,
pedantic, pedantic,
"redundant closures for method calls" "redundant closures for method calls"

View File

@ -40,6 +40,7 @@ declare_clippy_lint! {
/// }; /// };
/// let a = tmp + x; /// let a = tmp + x;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EVAL_ORDER_DEPENDENCE, pub EVAL_ORDER_DEPENDENCE,
suspicious, suspicious,
"whether a variable read occurs before a write depends on sub-expression evaluation order" "whether a variable read occurs before a write depends on sub-expression evaluation order"
@ -67,6 +68,7 @@ declare_clippy_lint! {
/// let x = (a, b, c, panic!()); /// let x = (a, b, c, panic!());
/// // can simply be replaced by `panic!()` /// // can simply be replaced by `panic!()`
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub DIVERGING_SUB_EXPRESSION, pub DIVERGING_SUB_EXPRESSION,
complexity, complexity,
"whether an expression contains a diverging sub expression" "whether an expression contains a diverging sub expression"

View File

@ -37,6 +37,7 @@ declare_clippy_lint! {
/// Finished, /// Finished,
/// } /// }
/// ``` /// ```
#[clippy::version = "1.43.0"]
pub STRUCT_EXCESSIVE_BOOLS, pub STRUCT_EXCESSIVE_BOOLS,
pedantic, pedantic,
"using too many bools in a struct" "using too many bools in a struct"
@ -75,6 +76,7 @@ declare_clippy_lint! {
/// ///
/// fn f(shape: Shape, temperature: Temperature) { ... } /// fn f(shape: Shape, temperature: Temperature) { ... }
/// ``` /// ```
#[clippy::version = "1.43.0"]
pub FN_PARAMS_EXCESSIVE_BOOLS, pub FN_PARAMS_EXCESSIVE_BOOLS,
pedantic, pedantic,
"using too many bools in function parameters" "using too many bools in function parameters"

View File

@ -31,6 +31,7 @@ declare_clippy_lint! {
/// Baz /// Baz
/// } /// }
/// ``` /// ```
#[clippy::version = "1.51.0"]
pub EXHAUSTIVE_ENUMS, pub EXHAUSTIVE_ENUMS,
restriction, restriction,
"detects exported enums that have not been marked #[non_exhaustive]" "detects exported enums that have not been marked #[non_exhaustive]"
@ -60,6 +61,7 @@ declare_clippy_lint! {
/// baz: String, /// baz: String,
/// } /// }
/// ``` /// ```
#[clippy::version = "1.51.0"]
pub EXHAUSTIVE_STRUCTS, pub EXHAUSTIVE_STRUCTS,
restriction, restriction,
"detects exported structs that have not been marked #[non_exhaustive]" "detects exported structs that have not been marked #[non_exhaustive]"

View File

@ -18,6 +18,7 @@ declare_clippy_lint! {
/// ```ignore /// ```ignore
/// std::process::exit(0) /// std::process::exit(0)
/// ``` /// ```
#[clippy::version = "1.41.0"]
pub EXIT, pub EXIT,
restriction, restriction,
"`std::process::exit` is called, terminating the program" "`std::process::exit` is called, terminating the program"

View File

@ -23,6 +23,7 @@ declare_clippy_lint! {
/// // this would be clearer as `eprintln!("foo: {:?}", bar);` /// // this would be clearer as `eprintln!("foo: {:?}", bar);`
/// writeln!(&mut std::io::stderr(), "foo: {:?}", bar).unwrap(); /// writeln!(&mut std::io::stderr(), "foo: {:?}", bar).unwrap();
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EXPLICIT_WRITE, pub EXPLICIT_WRITE,
complexity, complexity,
"using the `write!()` family of functions instead of the `print!()` family of functions, when using the latter would work" "using the `write!()` family of functions instead of the `print!()` family of functions, when using the latter would work"

View File

@ -44,6 +44,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub FALLIBLE_IMPL_FROM, pub FALLIBLE_IMPL_FROM,
nursery, nursery,
"Warn on impls of `From<..>` that contain `panic!()` or `unwrap()`" "Warn on impls of `From<..>` that contain `panic!()` or `unwrap()`"

View File

@ -31,6 +31,7 @@ declare_clippy_lint! {
/// ghi = [] /// ghi = []
/// ``` /// ```
/// ///
#[clippy::version = "1.57.0"]
pub REDUNDANT_FEATURE_NAMES, pub REDUNDANT_FEATURE_NAMES,
cargo, cargo,
"usage of a redundant feature name" "usage of a redundant feature name"
@ -60,6 +61,7 @@ declare_clippy_lint! {
/// def = [] /// def = []
/// ///
/// ``` /// ```
#[clippy::version = "1.57.0"]
pub NEGATIVE_FEATURE_NAMES, pub NEGATIVE_FEATURE_NAMES,
cargo, cargo,
"usage of a negative feature name" "usage of a negative feature name"

View File

@ -37,6 +37,7 @@ declare_clippy_lint! {
/// (a - b).abs() < f32::EPSILON /// (a - b).abs() < f32::EPSILON
/// } /// }
/// ``` /// ```
#[clippy::version = "1.48.0"]
pub FLOAT_EQUALITY_WITHOUT_ABS, pub FLOAT_EQUALITY_WITHOUT_ABS,
suspicious, suspicious,
"float equality check without `.abs()`" "float equality check without `.abs()`"

View File

@ -27,6 +27,7 @@ declare_clippy_lint! {
/// let v: f64 = 0.123_456_789_9; /// let v: f64 = 0.123_456_789_9;
/// println!("{}", v); // 0.123_456_789_9 /// println!("{}", v); // 0.123_456_789_9
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EXCESSIVE_PRECISION, pub EXCESSIVE_PRECISION,
style, style,
"excessive precision for float literal" "excessive precision for float literal"
@ -50,6 +51,7 @@ declare_clippy_lint! {
/// let _: f32 = 16_777_216.0; /// let _: f32 = 16_777_216.0;
/// let _: f64 = 16_777_217.0; /// let _: f64 = 16_777_217.0;
/// ``` /// ```
#[clippy::version = "1.43.0"]
pub LOSSY_FLOAT_LITERAL, pub LOSSY_FLOAT_LITERAL,
restriction, restriction,
"lossy whole number float literals" "lossy whole number float literals"

View File

@ -43,6 +43,7 @@ declare_clippy_lint! {
/// let _ = a.ln_1p(); /// let _ = a.ln_1p();
/// let _ = a.exp_m1(); /// let _ = a.exp_m1();
/// ``` /// ```
#[clippy::version = "1.43.0"]
pub IMPRECISE_FLOPS, pub IMPRECISE_FLOPS,
nursery, nursery,
"usage of imprecise floating point operations" "usage of imprecise floating point operations"
@ -99,6 +100,7 @@ declare_clippy_lint! {
/// let _ = a.abs(); /// let _ = a.abs();
/// let _ = -a.abs(); /// let _ = -a.abs();
/// ``` /// ```
#[clippy::version = "1.43.0"]
pub SUBOPTIMAL_FLOPS, pub SUBOPTIMAL_FLOPS,
nursery, nursery,
"usage of sub-optimal floating point operations" "usage of sub-optimal floating point operations"

View File

@ -33,6 +33,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// foo.to_owned(); /// foo.to_owned();
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub USELESS_FORMAT, pub USELESS_FORMAT,
complexity, complexity,
"useless use of `format!`" "useless use of `format!`"

View File

@ -31,6 +31,7 @@ declare_clippy_lint! {
/// # use std::panic::Location; /// # use std::panic::Location;
/// println!("error: something failed at {}", Location::caller()); /// println!("error: something failed at {}", Location::caller());
/// ``` /// ```
#[clippy::version = "1.58.0"]
pub FORMAT_IN_FORMAT_ARGS, pub FORMAT_IN_FORMAT_ARGS,
perf, perf,
"`format!` used in a macro that does formatting" "`format!` used in a macro that does formatting"
@ -56,6 +57,7 @@ declare_clippy_lint! {
/// # use std::panic::Location; /// # use std::panic::Location;
/// println!("error: something failed at {}", Location::caller()); /// println!("error: something failed at {}", Location::caller());
/// ``` /// ```
#[clippy::version = "1.58.0"]
pub TO_STRING_IN_FORMAT_ARGS, pub TO_STRING_IN_FORMAT_ARGS,
perf, perf,
"`to_string` applied to a type that implements `Display` in format args" "`to_string` applied to a type that implements `Display` in format args"

View File

@ -21,6 +21,7 @@ declare_clippy_lint! {
/// ```rust,ignore /// ```rust,ignore
/// a =- 42; // confusing, should it be `a -= 42` or `a = -42`? /// a =- 42; // confusing, should it be `a -= 42` or `a = -42`?
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub SUSPICIOUS_ASSIGNMENT_FORMATTING, pub SUSPICIOUS_ASSIGNMENT_FORMATTING,
suspicious, suspicious,
"suspicious formatting of `*=`, `-=` or `!=`" "suspicious formatting of `*=`, `-=` or `!=`"
@ -43,6 +44,7 @@ declare_clippy_lint! {
/// if foo &&! bar { // this should be `foo && !bar` but looks like a different operator /// if foo &&! bar { // this should be `foo && !bar` but looks like a different operator
/// } /// }
/// ``` /// ```
#[clippy::version = "1.40.0"]
pub SUSPICIOUS_UNARY_OP_FORMATTING, pub SUSPICIOUS_UNARY_OP_FORMATTING,
suspicious, suspicious,
"suspicious formatting of unary `-` or `!` on the RHS of a BinOp" "suspicious formatting of unary `-` or `!` on the RHS of a BinOp"
@ -79,6 +81,7 @@ declare_clippy_lint! {
/// if bar { // this is the `else` block of the previous `if`, but should it be? /// if bar { // this is the `else` block of the previous `if`, but should it be?
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub SUSPICIOUS_ELSE_FORMATTING, pub SUSPICIOUS_ELSE_FORMATTING,
suspicious, suspicious,
"suspicious formatting of `else`" "suspicious formatting of `else`"
@ -99,6 +102,7 @@ declare_clippy_lint! {
/// -4, -5, -6 /// -4, -5, -6
/// ]; /// ];
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub POSSIBLE_MISSING_COMMA, pub POSSIBLE_MISSING_COMMA,
correctness, correctness,
"possible missing comma in array" "possible missing comma in array"

View File

@ -34,6 +34,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "1.51.0"]
pub FROM_OVER_INTO, pub FROM_OVER_INTO,
style, style,
"Warns on implementations of `Into<..>` to use `From<..>`" "Warns on implementations of `Into<..>` to use `From<..>`"

View File

@ -35,6 +35,7 @@ declare_clippy_lint! {
/// let input: &str = get_input(); /// let input: &str = get_input();
/// let num: u16 = input.parse()?; /// let num: u16 = input.parse()?;
/// ``` /// ```
#[clippy::version = "1.52.0"]
pub FROM_STR_RADIX_10, pub FROM_STR_RADIX_10,
style, style,
"from_str_radix with radix 10" "from_str_radix with radix 10"

View File

@ -26,6 +26,7 @@ declare_clippy_lint! {
/// // .. /// // ..
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub TOO_MANY_ARGUMENTS, pub TOO_MANY_ARGUMENTS,
complexity, complexity,
"functions with too many arguments" "functions with too many arguments"
@ -49,6 +50,7 @@ declare_clippy_lint! {
/// println!(""); /// println!("");
/// } /// }
/// ``` /// ```
#[clippy::version = "1.34.0"]
pub TOO_MANY_LINES, pub TOO_MANY_LINES,
pedantic, pedantic,
"functions with too many lines" "functions with too many lines"
@ -84,6 +86,7 @@ declare_clippy_lint! {
/// println!("{}", unsafe { *x }); /// println!("{}", unsafe { *x });
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub NOT_UNSAFE_PTR_ARG_DEREF, pub NOT_UNSAFE_PTR_ARG_DEREF,
correctness, correctness,
"public functions dereferencing raw pointer arguments but not marked `unsafe`" "public functions dereferencing raw pointer arguments but not marked `unsafe`"
@ -103,6 +106,7 @@ declare_clippy_lint! {
/// #[must_use] /// #[must_use]
/// fn useless() { } /// fn useless() { }
/// ``` /// ```
#[clippy::version = "1.40.0"]
pub MUST_USE_UNIT, pub MUST_USE_UNIT,
style, style,
"`#[must_use]` attribute on a unit-returning function / method" "`#[must_use]` attribute on a unit-returning function / method"
@ -126,6 +130,7 @@ declare_clippy_lint! {
/// unimplemented!(); /// unimplemented!();
/// } /// }
/// ``` /// ```
#[clippy::version = "1.40.0"]
pub DOUBLE_MUST_USE, pub DOUBLE_MUST_USE,
style, style,
"`#[must_use]` attribute on a `#[must_use]`-returning function / method" "`#[must_use]` attribute on a `#[must_use]`-returning function / method"
@ -155,6 +160,7 @@ declare_clippy_lint! {
/// // this could be annotated with `#[must_use]`. /// // this could be annotated with `#[must_use]`.
/// fn id<T>(t: T) -> T { t } /// fn id<T>(t: T) -> T { t }
/// ``` /// ```
#[clippy::version = "1.40.0"]
pub MUST_USE_CANDIDATE, pub MUST_USE_CANDIDATE,
pedantic, pedantic,
"function or method that could take a `#[must_use]` attribute" "function or method that could take a `#[must_use]` attribute"
@ -204,6 +210,7 @@ declare_clippy_lint! {
/// ///
/// Note that there are crates that simplify creating the error type, e.g. /// Note that there are crates that simplify creating the error type, e.g.
/// [`thiserror`](https://docs.rs/thiserror). /// [`thiserror`](https://docs.rs/thiserror).
#[clippy::version = "1.49.0"]
pub RESULT_UNIT_ERR, pub RESULT_UNIT_ERR,
style, style,
"public function returning `Result` with an `Err` type of `()`" "public function returning `Result` with an `Err` type of `()`"

View File

@ -41,6 +41,7 @@ declare_clippy_lint! {
/// ```rust /// ```rust
/// async fn is_send(bytes: std::sync::Arc<[u8]>) {} /// async fn is_send(bytes: std::sync::Arc<[u8]>) {}
/// ``` /// ```
#[clippy::version = "1.44.0"]
pub FUTURE_NOT_SEND, pub FUTURE_NOT_SEND,
nursery, nursery,
"public Futures must be Send" "public Futures must be Send"

View File

@ -39,6 +39,7 @@ declare_clippy_lint! {
/// let x = vec![2, 3, 5]; /// let x = vec![2, 3, 5];
/// let last_element = x.last(); /// let last_element = x.last();
/// ``` /// ```
#[clippy::version = "1.37.0"]
pub GET_LAST_WITH_LEN, pub GET_LAST_WITH_LEN,
complexity, complexity,
"Using `x.get(x.len() - 1)` when `x.last()` is correct and simpler" "Using `x.get(x.len() - 1)` when `x.last()` is correct and simpler"

View File

@ -22,6 +22,7 @@ declare_clippy_lint! {
/// # let x = 1; /// # let x = 1;
/// x / 1 + 0 * 1 - 0 | 0; /// x / 1 + 0 * 1 - 0 | 0;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub IDENTITY_OP, pub IDENTITY_OP,
complexity, complexity,
"using identity operations, e.g., `x + 0` or `y / 1`" "using identity operations, e.g., `x + 0` or `y / 1`"

View File

@ -36,6 +36,7 @@ declare_clippy_lint! {
/// use_locked(locked); /// use_locked(locked);
/// } /// }
/// ``` /// ```
#[clippy::version = "1.45.0"]
pub IF_LET_MUTEX, pub IF_LET_MUTEX,
correctness, correctness,
"locking a `Mutex` in an `if let` block can cause deadlocks" "locking a `Mutex` in an `if let` block can cause deadlocks"

View File

@ -39,6 +39,7 @@ declare_clippy_lint! {
/// a() /// a()
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub IF_NOT_ELSE, pub IF_NOT_ELSE,
pedantic, pedantic,
"`if` branches that could be swapped so no negation operation is necessary on the condition" "`if` branches that could be swapped so no negation operation is necessary on the condition"

View File

@ -36,6 +36,7 @@ declare_clippy_lint! {
/// 42 /// 42
/// }); /// });
/// ``` /// ```
#[clippy::version = "1.53.0"]
pub IF_THEN_SOME_ELSE_NONE, pub IF_THEN_SOME_ELSE_NONE,
restriction, restriction,
"Finds if-else that could be written using `bool::then`" "Finds if-else that could be written using `bool::then`"

View File

@ -54,6 +54,7 @@ declare_clippy_lint! {
/// ///
/// pub fn foo<S: BuildHasher>(map: &mut HashMap<i32, i32, S>) { } /// pub fn foo<S: BuildHasher>(map: &mut HashMap<i32, i32, S>) { }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub IMPLICIT_HASHER, pub IMPLICIT_HASHER,
pedantic, pedantic,
"missing generalization over different hashers" "missing generalization over different hashers"

View File

@ -35,6 +35,7 @@ declare_clippy_lint! {
/// return x; /// return x;
/// } /// }
/// ``` /// ```
#[clippy::version = "1.33.0"]
pub IMPLICIT_RETURN, pub IMPLICIT_RETURN,
restriction, restriction,
"use a return statement like `return expr` instead of an expression" "use a return statement like `return expr` instead of an expression"

View File

@ -30,6 +30,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// i = i.saturating_sub(1); /// i = i.saturating_sub(1);
/// ``` /// ```
#[clippy::version = "1.44.0"]
pub IMPLICIT_SATURATING_SUB, pub IMPLICIT_SATURATING_SUB,
pedantic, pedantic,
"Perform saturating subtraction instead of implicitly checking lower bound of data type" "Perform saturating subtraction instead of implicitly checking lower bound of data type"

View File

@ -55,6 +55,7 @@ declare_clippy_lint! {
/// # let y = 2; /// # let y = 2;
/// Foo { x, y }; /// Foo { x, y };
/// ``` /// ```
#[clippy::version = "1.52.0"]
pub INCONSISTENT_STRUCT_CONSTRUCTOR, pub INCONSISTENT_STRUCT_CONSTRUCTOR,
pedantic, pedantic,
"the order of the field init shorthand is inconsistent with the order in the struct definition" "the order of the field init shorthand is inconsistent with the order in the struct definition"

View File

@ -33,6 +33,7 @@ declare_clippy_lint! {
/// x[0]; /// x[0];
/// x[3]; /// x[3];
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub OUT_OF_BOUNDS_INDEXING, pub OUT_OF_BOUNDS_INDEXING,
correctness, correctness,
"out of bounds constant indexing" "out of bounds constant indexing"
@ -85,6 +86,7 @@ declare_clippy_lint! {
/// y.get(10..); /// y.get(10..);
/// y.get(..100); /// y.get(..100);
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub INDEXING_SLICING, pub INDEXING_SLICING,
restriction, restriction,
"indexing/slicing usage" "indexing/slicing usage"

View File

@ -20,6 +20,7 @@ declare_clippy_lint! {
/// ///
/// iter::repeat(1_u8).collect::<Vec<_>>(); /// iter::repeat(1_u8).collect::<Vec<_>>();
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub INFINITE_ITER, pub INFINITE_ITER,
correctness, correctness,
"infinite iteration" "infinite iteration"
@ -42,6 +43,7 @@ declare_clippy_lint! {
/// let infinite_iter = 0..; /// let infinite_iter = 0..;
/// [0..].iter().zip(infinite_iter.take_while(|x| *x > 5)); /// [0..].iter().zip(infinite_iter.take_while(|x| *x > 5));
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub MAYBE_INFINITE_ITER, pub MAYBE_INFINITE_ITER,
pedantic, pedantic,
"possible infinite iteration" "possible infinite iteration"

View File

@ -36,6 +36,7 @@ declare_clippy_lint! {
/// fn other() {} /// fn other() {}
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub MULTIPLE_INHERENT_IMPL, pub MULTIPLE_INHERENT_IMPL,
restriction, restriction,
"Multiple inherent impl that could be grouped" "Multiple inherent impl that could be grouped"

View File

@ -41,6 +41,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "1.38.0"]
pub INHERENT_TO_STRING, pub INHERENT_TO_STRING,
style, style,
"type implements inherent method `to_string()`, but should instead implement the `Display` trait" "type implements inherent method `to_string()`, but should instead implement the `Display` trait"
@ -88,6 +89,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "1.38.0"]
pub INHERENT_TO_STRING_SHADOW_DISPLAY, pub INHERENT_TO_STRING_SHADOW_DISPLAY,
correctness, correctness,
"type implements inherent method `to_string()`, which gets shadowed by the implementation of the `Display` trait" "type implements inherent method `to_string()`, which gets shadowed by the implementation of the `Display` trait"

View File

@ -24,6 +24,7 @@ declare_clippy_lint! {
/// fn name(&self) -> &'static str; /// fn name(&self) -> &'static str;
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub INLINE_FN_WITHOUT_BODY, pub INLINE_FN_WITHOUT_BODY,
correctness, correctness,
"use of `#[inline]` on trait methods without bodies" "use of `#[inline]` on trait methods without bodies"

View File

@ -28,6 +28,7 @@ declare_clippy_lint! {
/// # let y = 1; /// # let y = 1;
/// if x > y {} /// if x > y {}
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub INT_PLUS_ONE, pub INT_PLUS_ONE,
complexity, complexity,
"instead of using `x >= y + 1`, use `x > y`" "instead of using `x >= y + 1`, use `x > y`"

View File

@ -23,6 +23,7 @@ declare_clippy_lint! {
/// let x = 3f32 / 2f32; /// let x = 3f32 / 2f32;
/// println!("{}", x); /// println!("{}", x);
/// ``` /// ```
#[clippy::version = "1.37.0"]
pub INTEGER_DIVISION, pub INTEGER_DIVISION,
restriction, restriction,
"integer division may cause loss of precision" "integer division may cause loss of precision"

View File

@ -30,6 +30,7 @@ declare_clippy_lint! {
/// let x: u8 = 1; /// let x: u8 = 1;
/// (x as u32) > 300; /// (x as u32) > 300;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub INVALID_UPCAST_COMPARISONS, pub INVALID_UPCAST_COMPARISONS,
pedantic, pedantic,
"a comparison involving an upcast which is always true or false" "a comparison involving an upcast which is always true or false"

View File

@ -45,6 +45,7 @@ declare_clippy_lint! {
/// foo(); // prints "foo" /// foo(); // prints "foo"
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub ITEMS_AFTER_STATEMENTS, pub ITEMS_AFTER_STATEMENTS,
pedantic, pedantic,
"blocks where an item comes after a statement" "blocks where an item comes after a statement"

View File

@ -32,6 +32,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "1.57.0"]
pub ITER_NOT_RETURNING_ITERATOR, pub ITER_NOT_RETURNING_ITERATOR,
pedantic, pedantic,
"methods named `iter` or `iter_mut` that do not return an `Iterator`" "methods named `iter` or `iter_mut` that do not return an `Iterator`"

View File

@ -27,6 +27,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// pub static a = [0u32; 1_000_000]; /// pub static a = [0u32; 1_000_000];
/// ``` /// ```
#[clippy::version = "1.44.0"]
pub LARGE_CONST_ARRAYS, pub LARGE_CONST_ARRAYS,
perf, perf,
"large non-scalar const array may cause performance overhead" "large non-scalar const array may cause performance overhead"

View File

@ -40,6 +40,7 @@ declare_clippy_lint! {
/// B(Box<[i32; 8000]>), /// B(Box<[i32; 8000]>),
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub LARGE_ENUM_VARIANT, pub LARGE_ENUM_VARIANT,
perf, perf,
"large size difference between variants on an enum" "large size difference between variants on an enum"

View File

@ -19,6 +19,7 @@ declare_clippy_lint! {
/// ```rust,ignore /// ```rust,ignore
/// let a = [0u32; 1_000_000]; /// let a = [0u32; 1_000_000];
/// ``` /// ```
#[clippy::version = "1.41.0"]
pub LARGE_STACK_ARRAYS, pub LARGE_STACK_ARRAYS,
pedantic, pedantic,
"allocating large arrays on stack may cause stack overflow" "allocating large arrays on stack may cause stack overflow"

View File

@ -46,6 +46,7 @@ declare_clippy_lint! {
/// .. /// ..
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub LEN_ZERO, pub LEN_ZERO,
style, style,
"checking `.len() == 0` or `.len() > 0` (or similar) when `.is_empty()` could be used instead" "checking `.len() == 0` or `.len() > 0` (or similar) when `.is_empty()` could be used instead"
@ -71,6 +72,7 @@ declare_clippy_lint! {
/// } /// }
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub LEN_WITHOUT_IS_EMPTY, pub LEN_WITHOUT_IS_EMPTY,
style, style,
"traits or impls with a public `len` method but no corresponding `is_empty` method" "traits or impls with a public `len` method but no corresponding `is_empty` method"
@ -108,6 +110,7 @@ declare_clippy_lint! {
/// .. /// ..
/// } /// }
/// ``` /// ```
#[clippy::version = "1.49.0"]
pub COMPARISON_TO_EMPTY, pub COMPARISON_TO_EMPTY,
style, style,
"checking `x == \"\"` or `x == []` (or similar) when `.is_empty()` could be used instead" "checking `x == \"\"` or `x == []` (or similar) when `.is_empty()` could be used instead"

View File

@ -48,6 +48,7 @@ declare_clippy_lint! {
/// None /// None
/// }; /// };
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub USELESS_LET_IF_SEQ, pub USELESS_LET_IF_SEQ,
nursery, nursery,
"unidiomatic `let mut` declaration followed by initialization in `if`" "unidiomatic `let mut` declaration followed by initialization in `if`"

View File

@ -26,6 +26,7 @@ declare_clippy_lint! {
/// // is_ok() is marked #[must_use] /// // is_ok() is marked #[must_use]
/// let _ = f().is_ok(); /// let _ = f().is_ok();
/// ``` /// ```
#[clippy::version = "1.42.0"]
pub LET_UNDERSCORE_MUST_USE, pub LET_UNDERSCORE_MUST_USE,
restriction, restriction,
"non-binding let on a `#[must_use]` expression" "non-binding let on a `#[must_use]` expression"
@ -53,6 +54,7 @@ declare_clippy_lint! {
/// ```rust,ignore /// ```rust,ignore
/// let _lock = mutex.lock(); /// let _lock = mutex.lock();
/// ``` /// ```
#[clippy::version = "1.43.0"]
pub LET_UNDERSCORE_LOCK, pub LET_UNDERSCORE_LOCK,
correctness, correctness,
"non-binding let on a synchronization lock" "non-binding let on a synchronization lock"
@ -94,6 +96,7 @@ declare_clippy_lint! {
/// // dropped at end of scope /// // dropped at end of scope
/// } /// }
/// ``` /// ```
#[clippy::version = "1.50.0"]
pub LET_UNDERSCORE_DROP, pub LET_UNDERSCORE_DROP,
pedantic, pedantic,
"non-binding let on a type that implements `Drop`" "non-binding let on a type that implements `Drop`"

View File

@ -45,6 +45,7 @@ declare_clippy_lint! {
/// x /// x
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub NEEDLESS_LIFETIMES, pub NEEDLESS_LIFETIMES,
complexity, complexity,
"using explicit lifetimes for references in function arguments when elision rules \ "using explicit lifetimes for references in function arguments when elision rules \
@ -73,6 +74,7 @@ declare_clippy_lint! {
/// // ... /// // ...
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EXTRA_UNUSED_LIFETIMES, pub EXTRA_UNUSED_LIFETIMES,
complexity, complexity,
"unused lifetimes in function definitions" "unused lifetimes in function definitions"

View File

@ -28,6 +28,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// let x: u64 = 61_864_918_973_511; /// let x: u64 = 61_864_918_973_511;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub UNREADABLE_LITERAL, pub UNREADABLE_LITERAL,
pedantic, pedantic,
"long literal without underscores" "long literal without underscores"
@ -53,6 +54,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// 2_i32; /// 2_i32;
/// ``` /// ```
#[clippy::version = "1.30.0"]
pub MISTYPED_LITERAL_SUFFIXES, pub MISTYPED_LITERAL_SUFFIXES,
correctness, correctness,
"mistyped literal suffix" "mistyped literal suffix"
@ -75,6 +77,7 @@ declare_clippy_lint! {
/// // Good /// // Good
/// let x: u64 = 61_864_918_973_511; /// let x: u64 = 61_864_918_973_511;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub INCONSISTENT_DIGIT_GROUPING, pub INCONSISTENT_DIGIT_GROUPING,
style, style,
"integer literals with digits grouped inconsistently" "integer literals with digits grouped inconsistently"
@ -93,6 +96,7 @@ declare_clippy_lint! {
/// let x: u32 = 0xFFF_FFF; /// let x: u32 = 0xFFF_FFF;
/// let y: u8 = 0b01_011_101; /// let y: u8 = 0b01_011_101;
/// ``` /// ```
#[clippy::version = "1.49.0"]
pub UNUSUAL_BYTE_GROUPINGS, pub UNUSUAL_BYTE_GROUPINGS,
style, style,
"binary or hex literals that aren't grouped by four" "binary or hex literals that aren't grouped by four"
@ -111,6 +115,7 @@ declare_clippy_lint! {
/// ```rust /// ```rust
/// let x: u64 = 6186491_8973511; /// let x: u64 = 6186491_8973511;
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub LARGE_DIGIT_GROUPS, pub LARGE_DIGIT_GROUPS,
pedantic, pedantic,
"grouping digits into groups that are too large" "grouping digits into groups that are too large"
@ -128,6 +133,7 @@ declare_clippy_lint! {
/// `255` => `0xFF` /// `255` => `0xFF`
/// `65_535` => `0xFFFF` /// `65_535` => `0xFFFF`
/// `4_042_322_160` => `0xF0F0_F0F0` /// `4_042_322_160` => `0xF0F0_F0F0`
#[clippy::version = "pre 1.29.0"]
pub DECIMAL_LITERAL_REPRESENTATION, pub DECIMAL_LITERAL_REPRESENTATION,
restriction, restriction,
"using decimal representation when hexadecimal would be better" "using decimal representation when hexadecimal would be better"

View File

@ -47,6 +47,7 @@ declare_clippy_lint! {
/// # let mut dst = vec![0; 65]; /// # let mut dst = vec![0; 65];
/// dst[64..(src.len() + 64)].clone_from_slice(&src[..]); /// dst[64..(src.len() + 64)].clone_from_slice(&src[..]);
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub MANUAL_MEMCPY, pub MANUAL_MEMCPY,
perf, perf,
"manually copying items between slices" "manually copying items between slices"
@ -75,6 +76,7 @@ declare_clippy_lint! {
/// println!("{}", i); /// println!("{}", i);
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub NEEDLESS_RANGE_LOOP, pub NEEDLESS_RANGE_LOOP,
style, style,
"for-looping over a range of indices where an iterator over items would do" "for-looping over a range of indices where an iterator over items would do"
@ -107,6 +109,7 @@ declare_clippy_lint! {
/// // .. /// // ..
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EXPLICIT_ITER_LOOP, pub EXPLICIT_ITER_LOOP,
pedantic, pedantic,
"for-looping over `_.iter()` or `_.iter_mut()` when `&_` or `&mut _` would do" "for-looping over `_.iter()` or `_.iter_mut()` when `&_` or `&mut _` would do"
@ -135,6 +138,7 @@ declare_clippy_lint! {
/// // .. /// // ..
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EXPLICIT_INTO_ITER_LOOP, pub EXPLICIT_INTO_ITER_LOOP,
pedantic, pedantic,
"for-looping over `_.into_iter()` when `_` would do" "for-looping over `_.into_iter()` when `_` would do"
@ -158,6 +162,7 @@ declare_clippy_lint! {
/// .. /// ..
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub ITER_NEXT_LOOP, pub ITER_NEXT_LOOP,
correctness, correctness,
"for-looping over `_.next()` which is probably not intended" "for-looping over `_.next()` which is probably not intended"
@ -201,6 +206,7 @@ declare_clippy_lint! {
/// // .. /// // ..
/// } /// }
/// ``` /// ```
#[clippy::version = "1.45.0"]
pub FOR_LOOPS_OVER_FALLIBLES, pub FOR_LOOPS_OVER_FALLIBLES,
suspicious, suspicious,
"for-looping over an `Option` or a `Result`, which is more clearly expressed as an `if let`" "for-looping over an `Option` or a `Result`, which is more clearly expressed as an `if let`"
@ -233,6 +239,7 @@ declare_clippy_lint! {
/// // .. do something with x /// // .. do something with x
/// }; /// };
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub WHILE_LET_LOOP, pub WHILE_LET_LOOP,
complexity, complexity,
"`loop { if let { ... } else break }`, which can be written as a `while let` loop" "`loop { if let { ... } else break }`, which can be written as a `while let` loop"
@ -254,6 +261,7 @@ declare_clippy_lint! {
/// // should be /// // should be
/// let len = iterator.count(); /// let len = iterator.count();
/// ``` /// ```
#[clippy::version = "1.30.0"]
pub NEEDLESS_COLLECT, pub NEEDLESS_COLLECT,
perf, perf,
"collecting an iterator when collect is not needed" "collecting an iterator when collect is not needed"
@ -284,6 +292,7 @@ declare_clippy_lint! {
/// # fn bar(bar: usize, baz: usize) {} /// # fn bar(bar: usize, baz: usize) {}
/// for (i, item) in v.iter().enumerate() { bar(i, *item); } /// for (i, item) in v.iter().enumerate() { bar(i, *item); }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EXPLICIT_COUNTER_LOOP, pub EXPLICIT_COUNTER_LOOP,
complexity, complexity,
"for-looping with an explicit counter when `_.enumerate()` would do" "for-looping with an explicit counter when `_.enumerate()` would do"
@ -317,6 +326,7 @@ declare_clippy_lint! {
/// ```no_run /// ```no_run
/// loop {} /// loop {}
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub EMPTY_LOOP, pub EMPTY_LOOP,
suspicious, suspicious,
"empty `loop {}`, which should block or sleep" "empty `loop {}`, which should block or sleep"
@ -336,6 +346,7 @@ declare_clippy_lint! {
/// .. /// ..
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub WHILE_LET_ON_ITERATOR, pub WHILE_LET_ON_ITERATOR,
style, style,
"using a `while let` loop instead of a for loop on an iterator" "using a `while let` loop instead of a for loop on an iterator"
@ -364,6 +375,7 @@ declare_clippy_lint! {
/// .. /// ..
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub FOR_KV_MAP, pub FOR_KV_MAP,
style, style,
"looping on a map using `iter` when `keys` or `values` would do" "looping on a map using `iter` when `keys` or `values` would do"
@ -385,6 +397,7 @@ declare_clippy_lint! {
/// break; /// break;
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub NEVER_LOOP, pub NEVER_LOOP,
correctness, correctness,
"any loop that will always `break` or `return`" "any loop that will always `break` or `return`"
@ -420,6 +433,7 @@ declare_clippy_lint! {
/// println!("{}", i); // prints numbers from 0 to 42, not 0 to 21 /// println!("{}", i); // prints numbers from 0 to 42, not 0 to 21
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub MUT_RANGE_BOUND, pub MUT_RANGE_BOUND,
suspicious, suspicious,
"for loop over a range where one of the bounds is a mutable variable" "for loop over a range where one of the bounds is a mutable variable"
@ -446,6 +460,7 @@ declare_clippy_lint! {
/// println!("let me loop forever!"); /// println!("let me loop forever!");
/// } /// }
/// ``` /// ```
#[clippy::version = "pre 1.29.0"]
pub WHILE_IMMUTABLE_CONDITION, pub WHILE_IMMUTABLE_CONDITION,
correctness, correctness,
"variables used within while expression are not mutated in the body" "variables used within while expression are not mutated in the body"
@ -480,6 +495,7 @@ declare_clippy_lint! {
/// let mut vec: Vec<u8> = vec![item1; 20]; /// let mut vec: Vec<u8> = vec![item1; 20];
/// vec.resize(20 + 30, item2); /// vec.resize(20 + 30, item2);
/// ``` /// ```
#[clippy::version = "1.47.0"]
pub SAME_ITEM_PUSH, pub SAME_ITEM_PUSH,
style, style,
"the same item is pushed inside of a for loop" "the same item is pushed inside of a for loop"
@ -506,6 +522,7 @@ declare_clippy_lint! {
/// let item = &item1; /// let item = &item1;
/// println!("{}", item); /// println!("{}", item);
/// ``` /// ```
#[clippy::version = "1.49.0"]
pub SINGLE_ELEMENT_LOOP, pub SINGLE_ELEMENT_LOOP,
complexity, complexity,
"there is no reason to have a single element loop" "there is no reason to have a single element loop"
@ -537,6 +554,7 @@ declare_clippy_lint! {
/// println!("{}", n); /// println!("{}", n);
/// } /// }
/// ``` /// ```
#[clippy::version = "1.52.0"]
pub MANUAL_FLATTEN, pub MANUAL_FLATTEN,
complexity, complexity,
"for loops over `Option`s or `Result`s with a single expression can be simplified" "for loops over `Option`s or `Result`s with a single expression can be simplified"

View File

@ -24,6 +24,7 @@ declare_clippy_lint! {
/// #[macro_use] /// #[macro_use]
/// use some_macro; /// use some_macro;
/// ``` /// ```
#[clippy::version = "1.44.0"]
pub MACRO_USE_IMPORTS, pub MACRO_USE_IMPORTS,
pedantic, pedantic,
"#[macro_use] is no longer needed" "#[macro_use] is no longer needed"

View File

@ -20,6 +20,7 @@ declare_clippy_lint! {
/// main(); /// main();
/// } /// }
/// ``` /// ```
#[clippy::version = "1.38.0"]
pub MAIN_RECURSION, pub MAIN_RECURSION,
style, style,
"recursion using the entrypoint" "recursion using the entrypoint"

View File

@ -26,6 +26,7 @@ declare_clippy_lint! {
/// let sad_people: Vec<&str> = vec![]; /// let sad_people: Vec<&str> = vec![];
/// assert!(sad_people.is_empty(), "there are sad people: {:?}", sad_people); /// assert!(sad_people.is_empty(), "there are sad people: {:?}", sad_people);
/// ``` /// ```
#[clippy::version = "1.57.0"]
pub MANUAL_ASSERT, pub MANUAL_ASSERT,
pedantic, pedantic,
"`panic!` and only a `panic!` in `if`-then statement" "`panic!` and only a `panic!` in `if`-then statement"

View File

@ -30,6 +30,7 @@ declare_clippy_lint! {
/// ```rust /// ```rust
/// async fn foo() -> i32 { 42 } /// async fn foo() -> i32 { 42 }
/// ``` /// ```
#[clippy::version = "1.45.0"]
pub MANUAL_ASYNC_FN, pub MANUAL_ASYNC_FN,
style, style,
"manual implementations of `async` functions can be simplified using the dedicated syntax" "manual implementations of `async` functions can be simplified using the dedicated syntax"

Some files were not shown because too many files have changed in this diff Show More