Skip to content

Commit b9dcdc0

Browse files
committed
Manually add clippy::version attribute to internal and deprecated lints
1 parent 750b719 commit b9dcdc0

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

clippy_dev/src/update_lints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static DEC_DEPRECATED_LINT_RE: SyncLazy<Regex> = SyncLazy::new(|| {
3232
r#"(?x)
3333
declare_deprecated_lint!\s*[{(]\s*
3434
(?:\s+///.*)*
35+
(?:\s*\#\[clippy::version\s*=\s*"[^"]*"\])
3536
\s+pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
3637
"(?P<desc>(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})]
3738
"#,

clippy_lints/src/deprecated_lints.rs

+16
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ declare_deprecated_lint! {
1818
/// ### Deprecation reason
1919
/// This used to check for `assert!(a == b)` and recommend
2020
/// replacement with `assert_eq!(a, b)`, but this is no longer needed after RFC 2011.
21+
#[clippy::version = "unknown"]
2122
pub SHOULD_ASSERT_EQ,
2223
"`assert!()` will be more flexible with RFC 2011"
2324
}
@@ -29,6 +30,7 @@ declare_deprecated_lint! {
2930
/// ### Deprecation reason
3031
/// This used to check for `Vec::extend`, which was slower than
3132
/// `Vec::extend_from_slice`. Thanks to specialization, this is no longer true.
33+
#[clippy::version = "unknown"]
3234
pub EXTEND_FROM_SLICE,
3335
"`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
3436
}
@@ -42,6 +44,7 @@ declare_deprecated_lint! {
4244
/// an infinite iterator, which is better expressed by `iter::repeat`,
4345
/// but the method has been removed for `Iterator::step_by` which panics
4446
/// if given a zero
47+
#[clippy::version = "unknown"]
4548
pub RANGE_STEP_BY_ZERO,
4649
"`iterator.step_by(0)` panics nowadays"
4750
}
@@ -53,6 +56,7 @@ declare_deprecated_lint! {
5356
/// ### Deprecation reason
5457
/// This used to check for `Vec::as_slice`, which was unstable with good
5558
/// stable alternatives. `Vec::as_slice` has now been stabilized.
59+
#[clippy::version = "unknown"]
5660
pub UNSTABLE_AS_SLICE,
5761
"`Vec::as_slice` has been stabilized in 1.7"
5862
}
@@ -64,6 +68,7 @@ declare_deprecated_lint! {
6468
/// ### Deprecation reason
6569
/// This used to check for `Vec::as_mut_slice`, which was unstable with good
6670
/// stable alternatives. `Vec::as_mut_slice` has now been stabilized.
71+
#[clippy::version = "unknown"]
6772
pub UNSTABLE_AS_MUT_SLICE,
6873
"`Vec::as_mut_slice` has been stabilized in 1.7"
6974
}
@@ -77,6 +82,7 @@ declare_deprecated_lint! {
7782
/// between non-pointer types of differing alignment is well-defined behavior (it's semantically
7883
/// equivalent to a memcpy). This lint has thus been refactored into two separate lints:
7984
/// cast_ptr_alignment and transmute_ptr_to_ptr.
85+
#[clippy::version = "unknown"]
8086
pub MISALIGNED_TRANSMUTE,
8187
"this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr"
8288
}
@@ -89,6 +95,7 @@ declare_deprecated_lint! {
8995
/// This lint is too subjective, not having a good reason for being in clippy.
9096
/// Additionally, compound assignment operators may be overloaded separately from their non-assigning
9197
/// counterparts, so this lint may suggest a change in behavior or the code may not compile.
98+
#[clippy::version = "1.29.0 -> 1.30.0"]
9299
pub ASSIGN_OPS,
93100
"using compound assignment operators (e.g., `+=`) is harmless"
94101
}
@@ -101,6 +108,7 @@ declare_deprecated_lint! {
101108
/// The original rule will only lint for `if let`. After
102109
/// making it support to lint `match`, naming as `if let` is not suitable for it.
103110
/// So, this lint is deprecated.
111+
#[clippy::version = "unknown"]
104112
pub IF_LET_REDUNDANT_PATTERN_MATCHING,
105113
"this lint has been changed to redundant_pattern_matching"
106114
}
@@ -114,6 +122,7 @@ declare_deprecated_lint! {
114122
/// Vec::with_capacity(n); vec.set_len(n);` with `let vec = vec![0; n];`. The
115123
/// replacement has very different performance characteristics so the lint is
116124
/// deprecated.
125+
#[clippy::version = "unknown"]
117126
pub UNSAFE_VECTOR_INITIALIZATION,
118127
"the replacement suggested by this lint had substantially different behavior"
119128
}
@@ -124,6 +133,7 @@ declare_deprecated_lint! {
124133
///
125134
/// ### Deprecation reason
126135
/// This lint has been superseded by #[must_use] in rustc.
136+
#[clippy::version = "1.29.0 -> 1.39.0"]
127137
pub UNUSED_COLLECT,
128138
"`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint"
129139
}
@@ -134,6 +144,7 @@ declare_deprecated_lint! {
134144
///
135145
/// ### Deprecation reason
136146
/// Associated-constants are now preferred.
147+
#[clippy::version = "1.29.0 -> 1.44.0"]
137148
pub REPLACE_CONSTS,
138149
"associated-constants `MIN`/`MAX` of integers are preferred to `{min,max}_value()` and module constants"
139150
}
@@ -144,6 +155,7 @@ declare_deprecated_lint! {
144155
///
145156
/// ### Deprecation reason
146157
/// The regex! macro does not exist anymore.
158+
#[clippy::version = "1.29.0 -> 1.47.0"]
147159
pub REGEX_MACRO,
148160
"the regex! macro has been removed from the regex crate in 2018"
149161
}
@@ -155,6 +167,7 @@ declare_deprecated_lint! {
155167
/// ### Deprecation reason
156168
/// This lint has been replaced by `manual_find_map`, a
157169
/// more specific lint.
170+
#[clippy::version = "1.36.0 -> 1.51.0"]
158171
pub FIND_MAP,
159172
"this lint has been replaced by `manual_find_map`, a more specific lint"
160173
}
@@ -166,6 +179,7 @@ declare_deprecated_lint! {
166179
/// ### Deprecation reason
167180
/// This lint has been replaced by `manual_filter_map`, a
168181
/// more specific lint.
182+
#[clippy::version = "1.29.0 -> 1.53.0"]
169183
pub FILTER_MAP,
170184
"this lint has been replaced by `manual_filter_map`, a more specific lint"
171185
}
@@ -178,6 +192,7 @@ declare_deprecated_lint! {
178192
/// The `avoid_breaking_exported_api` config option was added, which
179193
/// enables the `enum_variant_names` lint for public items.
180194
/// ```
195+
#[clippy::version = "1.29.0 -> 1.54.0"]
181196
pub PUB_ENUM_VARIANT_NAMES,
182197
"set the `avoid-breaking-exported-api` config option to `false` to enable the `enum_variant_names` lint for public items"
183198
}
@@ -189,6 +204,7 @@ declare_deprecated_lint! {
189204
/// ### Deprecation reason
190205
/// The `avoid_breaking_exported_api` config option was added, which
191206
/// enables the `wrong_self_conversion` lint for public items.
207+
#[clippy::version = "1.29.0 -> 1.54.0"]
192208
pub WRONG_PUB_SELF_CONVENTION,
193209
"set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items"
194210
}

clippy_lints/src/utils/internal_lints.rs

+12
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ declare_clippy_lint! {
4545
///
4646
/// ### Example
4747
/// Wrong ordering of the util::paths constants.
48+
#[clippy::version = "none"]
4849
pub CLIPPY_LINTS_INTERNAL,
4950
internal,
5051
"various things that will negatively affect your clippy experience"
@@ -72,6 +73,7 @@ declare_clippy_lint! {
7273
/// declare_lint_pass!(Pass => [LINT_1, LINT_2]);
7374
/// // missing FORGOTTEN_LINT
7475
/// ```
76+
#[clippy::version = "none"]
7577
pub LINT_WITHOUT_LINT_PASS,
7678
internal,
7779
"declaring a lint without associating it in a LintPass"
@@ -96,6 +98,7 @@ declare_clippy_lint! {
9698
/// ```rust,ignore
9799
/// utils::span_lint(cx, LINT_NAME, "message");
98100
/// ```
101+
#[clippy::version = "none"]
99102
pub COMPILER_LINT_FUNCTIONS,
100103
internal,
101104
"usage of the lint functions of the compiler instead of the utils::* variant"
@@ -119,6 +122,7 @@ declare_clippy_lint! {
119122
/// ```rust,ignore
120123
/// expr.span.ctxt().outer_expn_data()
121124
/// ```
125+
#[clippy::version = "none"]
122126
pub OUTER_EXPN_EXPN_DATA,
123127
internal,
124128
"using `cx.outer_expn().expn_data()` instead of `cx.outer_expn_data()`"
@@ -137,6 +141,7 @@ declare_clippy_lint! {
137141
/// ```rust,ignore
138142
/// 🍦🍦🍦🍦🍦
139143
/// ```
144+
#[clippy::version = "none"]
140145
pub PRODUCE_ICE,
141146
internal,
142147
"this message should not appear anywhere as we ICE before and don't emit the lint"
@@ -160,6 +165,7 @@ declare_clippy_lint! {
160165
/// ```rust,ignore
161166
/// declare_lint! { pub COOL_LINT, nursery, "a great new lint" }
162167
/// ```
168+
#[clippy::version = "none"]
163169
pub DEFAULT_LINT,
164170
internal,
165171
"found 'default lint description' in a lint declaration"
@@ -221,6 +227,7 @@ declare_clippy_lint! {
221227
/// span_lint_and_note(cx, TEST_LINT, expr.span, lint_msg, Some(expr.span), note_msg);
222228
/// span_lint_and_note(cx, TEST_LINT, expr.span, lint_msg, None, note_msg);
223229
/// ```
230+
#[clippy::version = "none"]
224231
pub COLLAPSIBLE_SPAN_LINT_CALLS,
225232
internal,
226233
"found collapsible `span_lint_and_then` calls"
@@ -244,6 +251,7 @@ declare_clippy_lint! {
244251
/// ```rust,ignore
245252
/// utils::is_type_diagnostic_item(cx, ty, sym::Vec)
246253
/// ```
254+
#[clippy::version = "none"]
247255
pub MATCH_TYPE_ON_DIAGNOSTIC_ITEM,
248256
internal,
249257
"using `utils::match_type()` instead of `utils::is_type_diagnostic_item()`"
@@ -258,6 +266,7 @@ declare_clippy_lint! {
258266
///
259267
/// ### Example
260268
/// None.
269+
#[clippy::version = "none"]
261270
pub INVALID_PATHS,
262271
internal,
263272
"invalid path"
@@ -280,6 +289,7 @@ declare_clippy_lint! {
280289
/// ```rust,ignore
281290
/// let _ = sym::f32;
282291
/// ```
292+
#[clippy::version = "none"]
283293
pub INTERNING_DEFINED_SYMBOL,
284294
internal,
285295
"interning a symbol that is pre-interned and defined as a constant"
@@ -302,13 +312,15 @@ declare_clippy_lint! {
302312
/// ```rust,ignore
303313
/// symbol == sym::clippy;
304314
/// ```
315+
#[clippy::version = "none"]
305316
pub UNNECESSARY_SYMBOL_STR,
306317
internal,
307318
"unnecessary conversion between Symbol and string"
308319
}
309320

310321
declare_clippy_lint! {
311322
/// Finds unidiomatic usage of `if_chain!`
323+
#[clippy::version = "none"]
312324
pub IF_CHAIN_STYLE,
313325
internal,
314326
"non-idiomatic `if_chain!` usage"

0 commit comments

Comments
 (0)