Manually add clippy::version attribute to deprecated lints

This commit is contained in:
xFrednet 2021-10-17 16:57:13 +02:00
parent 23ed79260b
commit 63cb41098b
No known key found for this signature in database
GPG key ID: FCDCBF29AF64D601
2 changed files with 18 additions and 1 deletions

View file

@ -18,7 +18,7 @@ static DEC_CLIPPY_LINT_RE: SyncLazy<Regex> = SyncLazy::new(|| {
r#"(?x)
declare_clippy_lint!\s*[\{(]
(?:\s+///.*)*
(?:\s*\#\[clippy::version\s*=\s*"[^"]*"\])
(?:\s*\#\[clippy::version\s*=\s*"[^"]*"\])?
\s+pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
(?P<cat>[a-z_]+)\s*,\s*
"(?P<desc>(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})]
@ -32,6 +32,7 @@ static DEC_DEPRECATED_LINT_RE: SyncLazy<Regex> = SyncLazy::new(|| {
r#"(?x)
declare_deprecated_lint!\s*[{(]\s*
(?:\s+///.*)*
(?:\s*\#\[clippy::version\s*=\s*"[^"]*"\])?
\s+pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
"(?P<desc>(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})]
"#,

View file

@ -21,6 +21,7 @@ declare_deprecated_lint! {
/// ### Deprecation reason
/// This used to check for `assert!(a == b)` and recommend
/// replacement with `assert_eq!(a, b)`, but this is no longer needed after RFC 2011.
#[clippy::version = "pre 1.29.0"]
pub SHOULD_ASSERT_EQ,
"`assert!()` will be more flexible with RFC 2011"
}
@ -32,6 +33,7 @@ declare_deprecated_lint! {
/// ### Deprecation reason
/// This used to check for `Vec::extend`, which was slower than
/// `Vec::extend_from_slice`. Thanks to specialization, this is no longer true.
#[clippy::version = "pre 1.29.0"]
pub EXTEND_FROM_SLICE,
"`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
}
@ -45,6 +47,7 @@ declare_deprecated_lint! {
/// an infinite iterator, which is better expressed by `iter::repeat`,
/// but the method has been removed for `Iterator::step_by` which panics
/// if given a zero
#[clippy::version = "pre 1.29.0"]
pub RANGE_STEP_BY_ZERO,
"`iterator.step_by(0)` panics nowadays"
}
@ -56,6 +59,7 @@ declare_deprecated_lint! {
/// ### Deprecation reason
/// This used to check for `Vec::as_slice`, which was unstable with good
/// stable alternatives. `Vec::as_slice` has now been stabilized.
#[clippy::version = "pre 1.29.0"]
pub UNSTABLE_AS_SLICE,
"`Vec::as_slice` has been stabilized in 1.7"
}
@ -67,6 +71,7 @@ declare_deprecated_lint! {
/// ### Deprecation reason
/// This used to check for `Vec::as_mut_slice`, which was unstable with good
/// stable alternatives. `Vec::as_mut_slice` has now been stabilized.
#[clippy::version = "pre 1.29.0"]
pub UNSTABLE_AS_MUT_SLICE,
"`Vec::as_mut_slice` has been stabilized in 1.7"
}
@ -80,6 +85,7 @@ declare_deprecated_lint! {
/// between non-pointer types of differing alignment is well-defined behavior (it's semantically
/// equivalent to a memcpy). This lint has thus been refactored into two separate lints:
/// cast_ptr_alignment and transmute_ptr_to_ptr.
#[clippy::version = "pre 1.29.0"]
pub MISALIGNED_TRANSMUTE,
"this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr"
}
@ -92,6 +98,7 @@ declare_deprecated_lint! {
/// This lint is too subjective, not having a good reason for being in clippy.
/// Additionally, compound assignment operators may be overloaded separately from their non-assigning
/// counterparts, so this lint may suggest a change in behavior or the code may not compile.
#[clippy::version = "1.30.0"]
pub ASSIGN_OPS,
"using compound assignment operators (e.g., `+=`) is harmless"
}
@ -104,6 +111,7 @@ declare_deprecated_lint! {
/// The original rule will only lint for `if let`. After
/// making it support to lint `match`, naming as `if let` is not suitable for it.
/// So, this lint is deprecated.
#[clippy::version = "pre 1.29.0"]
pub IF_LET_REDUNDANT_PATTERN_MATCHING,
"this lint has been changed to redundant_pattern_matching"
}
@ -117,6 +125,7 @@ declare_deprecated_lint! {
/// Vec::with_capacity(n); vec.set_len(n);` with `let vec = vec![0; n];`. The
/// replacement has very different performance characteristics so the lint is
/// deprecated.
#[clippy::version = "pre 1.29.0"]
pub UNSAFE_VECTOR_INITIALIZATION,
"the replacement suggested by this lint had substantially different behavior"
}
@ -127,6 +136,7 @@ declare_deprecated_lint! {
///
/// ### Deprecation reason
/// This lint has been superseded by #[must_use] in rustc.
#[clippy::version = "1.39.0"]
pub UNUSED_COLLECT,
"`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint"
}
@ -137,6 +147,7 @@ declare_deprecated_lint! {
///
/// ### Deprecation reason
/// Associated-constants are now preferred.
#[clippy::version = "1.44.0"]
pub REPLACE_CONSTS,
"associated-constants `MIN`/`MAX` of integers are preferred to `{min,max}_value()` and module constants"
}
@ -147,6 +158,7 @@ declare_deprecated_lint! {
///
/// ### Deprecation reason
/// The regex! macro does not exist anymore.
#[clippy::version = "1.47.0"]
pub REGEX_MACRO,
"the regex! macro has been removed from the regex crate in 2018"
}
@ -158,6 +170,7 @@ declare_deprecated_lint! {
/// ### Deprecation reason
/// This lint has been replaced by `manual_find_map`, a
/// more specific lint.
#[clippy::version = "1.51.0"]
pub FIND_MAP,
"this lint has been replaced by `manual_find_map`, a more specific lint"
}
@ -169,6 +182,7 @@ declare_deprecated_lint! {
/// ### Deprecation reason
/// This lint has been replaced by `manual_filter_map`, a
/// more specific lint.
#[clippy::version = "1.53.0"]
pub FILTER_MAP,
"this lint has been replaced by `manual_filter_map`, a more specific lint"
}
@ -181,6 +195,7 @@ declare_deprecated_lint! {
/// The `avoid_breaking_exported_api` config option was added, which
/// enables the `enum_variant_names` lint for public items.
/// ```
#[clippy::version = "1.54.0"]
pub PUB_ENUM_VARIANT_NAMES,
"set the `avoid-breaking-exported-api` config option to `false` to enable the `enum_variant_names` lint for public items"
}
@ -192,6 +207,7 @@ declare_deprecated_lint! {
/// ### Deprecation reason
/// The `avoid_breaking_exported_api` config option was added, which
/// enables the `wrong_self_conversion` lint for public items.
#[clippy::version = "1.54.0"]
pub WRONG_PUB_SELF_CONVENTION,
"set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items"
}