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 100 > i32::MAX {}
/// ```
#[clippy::version = "pre 1.29.0"]
pub ABSURD_EXTREME_COMPARISONS,
correctness,
"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 y = std::f64::consts::FRAC_1_PI;
/// ```
#[clippy::version = "pre 1.29.0"]
pub APPROX_CONSTANT,
correctness,
"the approximate of a known float constant (in `std::fXX::consts`)"

View File

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

View File

@ -38,6 +38,7 @@ declare_clippy_lint! {
/// f(a.try_into().expect("Unexpected u16 overflow in f"));
/// ```
///
#[clippy::version = "1.41.0"]
pub AS_CONVERSIONS,
restriction,
"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));
/// # }
/// ```
#[clippy::version = "1.49.0"]
pub INLINE_ASM_X86_INTEL_SYNTAX,
restriction,
"prefer AT&T x86 assembly syntax"
@ -111,6 +112,7 @@ declare_clippy_lint! {
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
/// # }
/// ```
#[clippy::version = "1.49.0"]
pub INLINE_ASM_X86_ATT_SYNTAX,
restriction,
"prefer Intel x86 assembly syntax"

View File

@ -26,6 +26,7 @@ declare_clippy_lint! {
/// const B: bool = false;
/// assert!(B)
/// ```
#[clippy::version = "1.34.0"]
pub ASSERTIONS_ON_CONSTANTS,
style,
"`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
/// a += b;
/// ```
#[clippy::version = "pre 1.29.0"]
pub ASSIGN_OP_PATTERN,
style,
"assigning the result of an operation on a variable to that same variable"
@ -60,6 +61,7 @@ declare_clippy_lint! {
/// // ...
/// a += a + b;
/// ```
#[clippy::version = "pre 1.29.0"]
pub MISREFACTORED_ASSIGN_OP,
suspicious,
"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,
correctness,
"async blocks that return a type that can be awaited"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,6 +23,7 @@ declare_clippy_lint! {
/// // Good
/// assert!(!"a".is_empty());
/// ```
#[clippy::version = "1.53.0"]
pub BOOL_ASSERT_COMPARISON,
style,
"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 == b) // should be: if a != b
/// ```
#[clippy::version = "pre 1.29.0"]
pub NONMINIMAL_BOOL,
complexity,
"boolean expressions that can be written more concisely"
@ -52,6 +53,7 @@ declare_clippy_lint! {
/// if a && b || a { ... }
/// ```
/// The `b` is unnecessary, the expression is equivalent to `if a`.
#[clippy::version = "pre 1.29.0"]
pub LOGIC_BUG,
correctness,
"boolean expressions that contain terminals which can be eliminated"

View File

@ -30,6 +30,7 @@ declare_clippy_lint! {
/// # let vec = vec![1_u8];
/// &vec.iter().filter(|x| **x == 0u8).count(); // use bytecount::count instead
/// ```
#[clippy::version = "pre 1.29.0"]
pub NAIVE_BYTECOUNT,
pedantic,
"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"]
/// categories = ["development-tools", "development-tools::cargo-plugins"]
/// ```
#[clippy::version = "1.32.0"]
pub CARGO_COMMON_METADATA,
cargo,
"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)
/// }
/// ```
#[clippy::version = "1.51.0"]
pub CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS,
pedantic,
"Checks for calls to ends_with with case-sensitive file extensions"

View File

@ -40,6 +40,7 @@ declare_clippy_lint! {
/// let x = u64::MAX;
/// x as f64;
/// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_PRECISION_LOSS,
pedantic,
"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;
/// y as u128; // will return 18446744073709551615
/// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_SIGN_LOSS,
pedantic,
"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
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_POSSIBLE_TRUNCATION,
pedantic,
"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
/// u32::MAX as i32; // will yield a value of `-1`
/// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_POSSIBLE_WRAP,
pedantic,
"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)
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_LOSSLESS,
pedantic,
"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 _ = 0.5_f32;
/// ```
#[clippy::version = "pre 1.29.0"]
pub UNNECESSARY_CAST,
complexity,
"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>();
/// (&mut 1u8 as *mut u8).cast::<u16>();
/// ```
#[clippy::version = "pre 1.29.0"]
pub CAST_PTR_ALIGNMENT,
pedantic,
"cast from a pointer to a more-strictly-aligned pointer"
@ -217,6 +224,7 @@ declare_clippy_lint! {
/// fn fun2() -> i32 { 1 }
/// let a = fun2 as usize;
/// ```
#[clippy::version = "pre 1.29.0"]
pub FN_TO_NUMERIC_CAST,
style,
"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_truncated = fn_ptr as i32;
/// ```
#[clippy::version = "pre 1.29.0"]
pub FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
style,
"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;
/// ```
#[clippy::version = "1.58.0"]
pub FN_TO_NUMERIC_CAST_ANY,
restriction,
"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,
correctness,
"a cast of reference to a mutable pointer"
@ -344,6 +355,7 @@ declare_clippy_lint! {
/// ```rust,ignore
/// b'x'
/// ```
#[clippy::version = "pre 1.29.0"]
pub CHAR_LIT_AS_U8,
complexity,
"casting a character literal to `u8` truncates"
@ -372,6 +384,7 @@ declare_clippy_lint! {
/// let _ = ptr.cast::<i32>();
/// let _ = mut_ptr.cast::<i32>();
/// ```
#[clippy::version = "1.51.0"]
pub PTR_AS_PTR,
pedantic,
"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()
/// # ;
/// ```
#[clippy::version = "1.37.0"]
pub CHECKED_CONVERSIONS,
pedantic,
"`try_from` could replace manual bounds checking when casting"

View File

@ -27,6 +27,7 @@ declare_clippy_lint! {
///
/// ### Example
/// No. You'll see it when you get the warning.
#[clippy::version = "1.35.0"]
pub COGNITIVE_COMPLEXITY,
nursery,
"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,
style,
"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,
style,
"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,
style,
"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,
style,
"`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,
correctness,
"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,
pedantic,
"consecutive `if`s with the same function call"
@ -109,6 +111,7 @@ declare_clippy_lint! {
/// 42
/// };
/// ```
#[clippy::version = "pre 1.29.0"]
pub IF_SAME_THEN_ELSE,
correctness,
"`if` with the same `then` and `else` blocks"
@ -147,6 +150,7 @@ declare_clippy_lint! {
/// 42
/// };
/// ```
#[clippy::version = "1.53.0"]
pub BRANCHES_SHARING_CODE,
nursery,
"`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 b: Vec<_> = my_iterator.collect();
/// ```
#[clippy::version = "1.30.0"]
pub COPY_ITERATOR,
pedantic,
"implementing `Iterator` on a `Copy` type"

View File

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

View File

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

View File

@ -29,6 +29,7 @@ declare_clippy_lint! {
/// // Good
/// let s = String::default();
/// ```
#[clippy::version = "pre 1.29.0"]
pub DEFAULT_TRAIT_ACCESS,
pedantic,
"checks for literal calls to `Default::default()`"
@ -62,6 +63,7 @@ declare_clippy_lint! {
/// .. Default::default()
/// };
/// ```
#[clippy::version = "1.49.0"]
pub FIELD_REASSIGN_WITH_DEFAULT,
style,
"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 f = 1.23f64;
/// ```
#[clippy::version = "1.52.0"]
pub DEFAULT_NUMERIC_FALLBACK,
restriction,
"usage of unconstrained numeric literals which may cause default numeric fallback."

View File

@ -34,6 +34,7 @@ declare_clippy_lint! {
/// ```rust,ignore
/// let _ = d.unwrap().deref();
/// ```
#[clippy::version = "1.44.0"]
pub EXPLICIT_DEREF_METHODS,
pedantic,
"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
/// generic parameters.
///
#[clippy::version = "1.57.0"]
pub DERIVABLE_IMPLS,
complexity,
"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,
correctness,
"deriving `Hash` but implementing `PartialEq` explicitly"
@ -88,6 +89,7 @@ declare_clippy_lint! {
/// #[derive(Ord, PartialOrd, PartialEq, Eq)]
/// struct Foo;
/// ```
#[clippy::version = "1.47.0"]
pub DERIVE_ORD_XOR_PARTIAL_ORD,
correctness,
"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,
pedantic,
"implementing `Clone` explicitly on `Copy` types"
@ -147,6 +150,7 @@ declare_clippy_lint! {
/// }
/// }
/// ```
#[clippy::version = "1.45.0"]
pub UNSAFE_DERIVE_DESERIALIZE,
pedantic,
"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.
/// xs.push(123); // Vec::push is _not_ disallowed in the config.
/// ```
#[clippy::version = "1.49.0"]
pub DISALLOWED_METHOD,
nursery,
"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 カウンタ = 10; // Will spawn the lint.
/// ```
#[clippy::version = "1.55.0"]
pub DISALLOWED_SCRIPT_IDENTS,
restriction,
"usage of non-allowed Unicode scripts"

View File

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

View File

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

View File

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

View File

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

View File

@ -25,6 +25,7 @@ declare_clippy_lint! {
/// // still locked
/// operation_that_requires_mutex_to_be_unlocked();
/// ```
#[clippy::version = "pre 1.29.0"]
pub DROP_REF,
correctness,
"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);
/// std::mem::forget(&x) // Should have been forget(x), x will still be dropped
/// ```
#[clippy::version = "pre 1.29.0"]
pub FORGET_REF,
correctness,
"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
/// // original unaffected
/// ```
#[clippy::version = "pre 1.29.0"]
pub DROP_COPY,
correctness,
"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
/// // original unaffected
/// ```
#[clippy::version = "pre 1.29.0"]
pub FORGET_COPY,
correctness,
"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 _millis = dur.subsec_millis();
/// ```
#[clippy::version = "pre 1.29.0"]
pub DURATION_SUBSEC,
complexity,
"checks for calculation of subsecond microseconds or milliseconds"

View File

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

View File

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

View File

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

View File

@ -28,6 +28,7 @@ declare_clippy_lint! {
/// Y = 0,
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub ENUM_CLIKE_UNPORTABLE_VARIANT,
correctness,
"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,
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub ENUM_VARIANT_NAMES,
style,
"enums where all variants share a prefix/postfix"
@ -59,6 +60,7 @@ declare_clippy_lint! {
/// struct BlackForest;
/// }
/// ```
#[clippy::version = "1.33.0"]
pub MODULE_NAME_REPETITIONS,
pedantic,
"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,
style,
"modules that have the same name as their parent module"

View File

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

View File

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

View File

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

View File

@ -41,6 +41,7 @@ declare_clippy_lint! {
/// foo(x);
/// println!("{}", x);
/// ```
#[clippy::version = "pre 1.29.0"]
pub BOXED_LOCAL,
perf,
"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
/// `x`.
#[clippy::version = "pre 1.29.0"]
pub REDUNDANT_CLOSURE,
style,
"redundant closures, i.e., `|a| foo(a)` (which can be written as just `foo`)"
@ -60,6 +61,7 @@ declare_clippy_lint! {
/// ```rust,ignore
/// Some('a').map(char::to_uppercase);
/// ```
#[clippy::version = "1.35.0"]
pub REDUNDANT_CLOSURE_FOR_METHOD_CALLS,
pedantic,
"redundant closures for method calls"

View File

@ -40,6 +40,7 @@ declare_clippy_lint! {
/// };
/// let a = tmp + x;
/// ```
#[clippy::version = "pre 1.29.0"]
pub EVAL_ORDER_DEPENDENCE,
suspicious,
"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!());
/// // can simply be replaced by `panic!()`
/// ```
#[clippy::version = "pre 1.29.0"]
pub DIVERGING_SUB_EXPRESSION,
complexity,
"whether an expression contains a diverging sub expression"

View File

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

View File

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

View File

@ -18,6 +18,7 @@ declare_clippy_lint! {
/// ```ignore
/// std::process::exit(0)
/// ```
#[clippy::version = "1.41.0"]
pub EXIT,
restriction,
"`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);`
/// writeln!(&mut std::io::stderr(), "foo: {:?}", bar).unwrap();
/// ```
#[clippy::version = "pre 1.29.0"]
pub EXPLICIT_WRITE,
complexity,
"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,
nursery,
"Warn on impls of `From<..>` that contain `panic!()` or `unwrap()`"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,6 +21,7 @@ declare_clippy_lint! {
/// ```rust,ignore
/// a =- 42; // confusing, should it be `a -= 42` or `a = -42`?
/// ```
#[clippy::version = "pre 1.29.0"]
pub SUSPICIOUS_ASSIGNMENT_FORMATTING,
suspicious,
"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
/// }
/// ```
#[clippy::version = "1.40.0"]
pub SUSPICIOUS_UNARY_OP_FORMATTING,
suspicious,
"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?
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub SUSPICIOUS_ELSE_FORMATTING,
suspicious,
"suspicious formatting of `else`"
@ -99,6 +102,7 @@ declare_clippy_lint! {
/// -4, -5, -6
/// ];
/// ```
#[clippy::version = "pre 1.29.0"]
pub POSSIBLE_MISSING_COMMA,
correctness,
"possible missing comma in array"

View File

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

View File

@ -35,6 +35,7 @@ declare_clippy_lint! {
/// let input: &str = get_input();
/// let num: u16 = input.parse()?;
/// ```
#[clippy::version = "1.52.0"]
pub FROM_STR_RADIX_10,
style,
"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,
complexity,
"functions with too many arguments"
@ -49,6 +50,7 @@ declare_clippy_lint! {
/// println!("");
/// }
/// ```
#[clippy::version = "1.34.0"]
pub TOO_MANY_LINES,
pedantic,
"functions with too many lines"
@ -84,6 +86,7 @@ declare_clippy_lint! {
/// println!("{}", unsafe { *x });
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub NOT_UNSAFE_PTR_ARG_DEREF,
correctness,
"public functions dereferencing raw pointer arguments but not marked `unsafe`"
@ -103,6 +106,7 @@ declare_clippy_lint! {
/// #[must_use]
/// fn useless() { }
/// ```
#[clippy::version = "1.40.0"]
pub MUST_USE_UNIT,
style,
"`#[must_use]` attribute on a unit-returning function / method"
@ -126,6 +130,7 @@ declare_clippy_lint! {
/// unimplemented!();
/// }
/// ```
#[clippy::version = "1.40.0"]
pub DOUBLE_MUST_USE,
style,
"`#[must_use]` attribute on a `#[must_use]`-returning function / method"
@ -155,6 +160,7 @@ declare_clippy_lint! {
/// // this could be annotated with `#[must_use]`.
/// fn id<T>(t: T) -> T { t }
/// ```
#[clippy::version = "1.40.0"]
pub MUST_USE_CANDIDATE,
pedantic,
"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.
/// [`thiserror`](https://docs.rs/thiserror).
#[clippy::version = "1.49.0"]
pub RESULT_UNIT_ERR,
style,
"public function returning `Result` with an `Err` type of `()`"

View File

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

View File

@ -39,6 +39,7 @@ declare_clippy_lint! {
/// let x = vec![2, 3, 5];
/// let last_element = x.last();
/// ```
#[clippy::version = "1.37.0"]
pub GET_LAST_WITH_LEN,
complexity,
"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;
/// x / 1 + 0 * 1 - 0 | 0;
/// ```
#[clippy::version = "pre 1.29.0"]
pub IDENTITY_OP,
complexity,
"using identity operations, e.g., `x + 0` or `y / 1`"

View File

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

View File

@ -39,6 +39,7 @@ declare_clippy_lint! {
/// a()
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub IF_NOT_ELSE,
pedantic,
"`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
/// });
/// ```
#[clippy::version = "1.53.0"]
pub IF_THEN_SOME_ELSE_NONE,
restriction,
"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>) { }
/// ```
#[clippy::version = "pre 1.29.0"]
pub IMPLICIT_HASHER,
pedantic,
"missing generalization over different hashers"

View File

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

View File

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

View File

@ -55,6 +55,7 @@ declare_clippy_lint! {
/// # let y = 2;
/// Foo { x, y };
/// ```
#[clippy::version = "1.52.0"]
pub INCONSISTENT_STRUCT_CONSTRUCTOR,
pedantic,
"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[3];
/// ```
#[clippy::version = "pre 1.29.0"]
pub OUT_OF_BOUNDS_INDEXING,
correctness,
"out of bounds constant indexing"
@ -85,6 +86,7 @@ declare_clippy_lint! {
/// y.get(10..);
/// y.get(..100);
/// ```
#[clippy::version = "pre 1.29.0"]
pub INDEXING_SLICING,
restriction,
"indexing/slicing usage"

View File

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

View File

@ -36,6 +36,7 @@ declare_clippy_lint! {
/// fn other() {}
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub MULTIPLE_INHERENT_IMPL,
restriction,
"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,
style,
"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,
correctness,
"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;
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub INLINE_FN_WITHOUT_BODY,
correctness,
"use of `#[inline]` on trait methods without bodies"

View File

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

View File

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

View File

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

View File

@ -45,6 +45,7 @@ declare_clippy_lint! {
/// foo(); // prints "foo"
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub ITEMS_AFTER_STATEMENTS,
pedantic,
"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,
pedantic,
"methods named `iter` or `iter_mut` that do not return an `Iterator`"

View File

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

View File

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

View File

@ -19,6 +19,7 @@ declare_clippy_lint! {
/// ```rust,ignore
/// let a = [0u32; 1_000_000];
/// ```
#[clippy::version = "1.41.0"]
pub LARGE_STACK_ARRAYS,
pedantic,
"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,
style,
"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,
style,
"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,
style,
"checking `x == \"\"` or `x == []` (or similar) when `.is_empty()` could be used instead"

View File

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

View File

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

View File

@ -45,6 +45,7 @@ declare_clippy_lint! {
/// x
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub NEEDLESS_LIFETIMES,
complexity,
"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,
complexity,
"unused lifetimes in function definitions"

View File

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

View File

@ -47,6 +47,7 @@ declare_clippy_lint! {
/// # let mut dst = vec![0; 65];
/// dst[64..(src.len() + 64)].clone_from_slice(&src[..]);
/// ```
#[clippy::version = "pre 1.29.0"]
pub MANUAL_MEMCPY,
perf,
"manually copying items between slices"
@ -75,6 +76,7 @@ declare_clippy_lint! {
/// println!("{}", i);
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub NEEDLESS_RANGE_LOOP,
style,
"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,
pedantic,
"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,
pedantic,
"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,
correctness,
"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,
suspicious,
"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
/// };
/// ```
#[clippy::version = "pre 1.29.0"]
pub WHILE_LET_LOOP,
complexity,
"`loop { if let { ... } else break }`, which can be written as a `while let` loop"
@ -254,6 +261,7 @@ declare_clippy_lint! {
/// // should be
/// let len = iterator.count();
/// ```
#[clippy::version = "1.30.0"]
pub NEEDLESS_COLLECT,
perf,
"collecting an iterator when collect is not needed"
@ -284,6 +292,7 @@ declare_clippy_lint! {
/// # fn bar(bar: usize, baz: usize) {}
/// for (i, item) in v.iter().enumerate() { bar(i, *item); }
/// ```
#[clippy::version = "pre 1.29.0"]
pub EXPLICIT_COUNTER_LOOP,
complexity,
"for-looping with an explicit counter when `_.enumerate()` would do"
@ -317,6 +326,7 @@ declare_clippy_lint! {
/// ```no_run
/// loop {}
/// ```
#[clippy::version = "pre 1.29.0"]
pub EMPTY_LOOP,
suspicious,
"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,
style,
"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,
style,
"looping on a map using `iter` when `keys` or `values` would do"
@ -385,6 +397,7 @@ declare_clippy_lint! {
/// break;
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub NEVER_LOOP,
correctness,
"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
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub MUT_RANGE_BOUND,
suspicious,
"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!");
/// }
/// ```
#[clippy::version = "pre 1.29.0"]
pub WHILE_IMMUTABLE_CONDITION,
correctness,
"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];
/// vec.resize(20 + 30, item2);
/// ```
#[clippy::version = "1.47.0"]
pub SAME_ITEM_PUSH,
style,
"the same item is pushed inside of a for loop"
@ -506,6 +522,7 @@ declare_clippy_lint! {
/// let item = &item1;
/// println!("{}", item);
/// ```
#[clippy::version = "1.49.0"]
pub SINGLE_ELEMENT_LOOP,
complexity,
"there is no reason to have a single element loop"
@ -537,6 +554,7 @@ declare_clippy_lint! {
/// println!("{}", n);
/// }
/// ```
#[clippy::version = "1.52.0"]
pub MANUAL_FLATTEN,
complexity,
"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]
/// use some_macro;
/// ```
#[clippy::version = "1.44.0"]
pub MACRO_USE_IMPORTS,
pedantic,
"#[macro_use] is no longer needed"

View File

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

View File

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

View File

@ -30,6 +30,7 @@ declare_clippy_lint! {
/// ```rust
/// async fn foo() -> i32 { 42 }
/// ```
#[clippy::version = "1.45.0"]
pub MANUAL_ASYNC_FN,
style,
"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