Skip to content

Commit 3c032ae

Browse files
committed
Added clippy::version attribute to all 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 beta rust-1.56.0 mv master rust-1.57.0; let paths = (open ./rust-1.57.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 ";" | save "replacer.sh"; ``` And this still has some problems, but at this point I just want to be done -.-
1 parent 9f44c77 commit 3c032ae

File tree

234 files changed

+487
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

234 files changed

+487
-0
lines changed

clippy_lints/src/absurd_extreme_comparisons.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ declare_clippy_lint! {
3636
/// if vec.len() <= 0 {}
3737
/// if 100 > i32::MAX {}
3838
/// ```
39+
#[clippy::version = "1.29.0"]
3940
pub ABSURD_EXTREME_COMPARISONS,
4041
correctness,
4142
"a comparison with a maximum or minimum value that is always true or false"

clippy_lints/src/approx_const.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ declare_clippy_lint! {
3333
/// let x = std::f32::consts::PI;
3434
/// let y = std::f64::consts::FRAC_1_PI;
3535
/// ```
36+
#[clippy::version = "1.29.0"]
3637
pub APPROX_CONSTANT,
3738
correctness,
3839
"the approximate of a known float constant (in `std::fXX::consts`)"

clippy_lints/src/arithmetic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ declare_clippy_lint! {
2525
/// # let a = 0;
2626
/// a + 1;
2727
/// ```
28+
#[clippy::version = "1.29.0"]
2829
pub INTEGER_ARITHMETIC,
2930
restriction,
3031
"any integer arithmetic expression which could overflow or panic"
@@ -43,6 +44,7 @@ declare_clippy_lint! {
4344
/// # let a = 0.0;
4445
/// a + 1.0;
4546
/// ```
47+
#[clippy::version = "1.29.0"]
4648
pub FLOAT_ARITHMETIC,
4749
restriction,
4850
"any floating-point arithmetic statement"

clippy_lints/src/as_conversions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ declare_clippy_lint! {
3838
/// f(a.try_into().expect("Unexpected u16 overflow in f"));
3939
/// ```
4040
///
41+
#[clippy::version = "1.41.0"]
4142
pub AS_CONVERSIONS,
4243
restriction,
4344
"using a potentially dangerous silent `as` conversion"

clippy_lints/src/asm_syntax.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ declare_clippy_lint! {
7575
/// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax));
7676
/// # }
7777
/// ```
78+
#[clippy::version = "1.49.0"]
7879
pub INLINE_ASM_X86_INTEL_SYNTAX,
7980
restriction,
8081
"prefer AT&T x86 assembly syntax"
@@ -111,6 +112,7 @@ declare_clippy_lint! {
111112
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
112113
/// # }
113114
/// ```
115+
#[clippy::version = "1.49.0"]
114116
pub INLINE_ASM_X86_ATT_SYNTAX,
115117
restriction,
116118
"prefer Intel x86 assembly syntax"

clippy_lints/src/assertions_on_constants.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ declare_clippy_lint! {
2626
/// const B: bool = false;
2727
/// assert!(B)
2828
/// ```
29+
#[clippy::version = "1.34.0"]
2930
pub ASSERTIONS_ON_CONSTANTS,
3031
style,
3132
"`assert!(true)` / `assert!(false)` will be optimized out by the compiler, and should probably be replaced by a `panic!()` or `unreachable!()`"

clippy_lints/src/assign_ops.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ declare_clippy_lint! {
3434
/// // Good
3535
/// a += b;
3636
/// ```
37+
#[clippy::version = "1.29.0"]
3738
pub ASSIGN_OP_PATTERN,
3839
style,
3940
"assigning the result of an operation on a variable to that same variable"
@@ -60,6 +61,7 @@ declare_clippy_lint! {
6061
/// // ...
6162
/// a += a + b;
6263
/// ```
64+
#[clippy::version = "1.29.0"]
6365
pub MISREFACTORED_ASSIGN_OP,
6466
suspicious,
6567
"having a variable on both sides of an assign op"

clippy_lints/src/async_yields_async.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ declare_clippy_lint! {
3434
/// };
3535
/// }
3636
/// ```
37+
#[clippy::version = "1.48.0"]
3738
pub ASYNC_YIELDS_ASYNC,
3839
correctness,
3940
"async blocks that return a type that can be awaited"

clippy_lints/src/attrs.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ declare_clippy_lint! {
6464
/// #[inline(always)]
6565
/// fn not_quite_hot_code(..) { ... }
6666
/// ```
67+
#[clippy::version = "1.29.0"]
6768
pub INLINE_ALWAYS,
6869
pedantic,
6970
"use of `#[inline(always)]`"
@@ -98,6 +99,7 @@ declare_clippy_lint! {
9899
/// #[macro_use]
99100
/// extern crate baz;
100101
/// ```
102+
#[clippy::version = "1.29.0"]
101103
pub USELESS_ATTRIBUTE,
102104
correctness,
103105
"use of lint attributes on `extern crate` items"
@@ -117,6 +119,7 @@ declare_clippy_lint! {
117119
/// #[deprecated(since = "forever")]
118120
/// fn something_else() { /* ... */ }
119121
/// ```
122+
#[clippy::version = "1.29.0"]
120123
pub DEPRECATED_SEMVER,
121124
correctness,
122125
"use of `#[deprecated(since = \"x\")]` where x is not semver"
@@ -154,6 +157,7 @@ declare_clippy_lint! {
154157
/// #[allow(dead_code)]
155158
/// fn this_is_fine_too() { }
156159
/// ```
160+
#[clippy::version = "1.29.0"]
157161
pub EMPTY_LINE_AFTER_OUTER_ATTR,
158162
nursery,
159163
"empty line after outer attribute"
@@ -177,6 +181,7 @@ declare_clippy_lint! {
177181
/// ```rust
178182
/// #![deny(clippy::as_conversions)]
179183
/// ```
184+
#[clippy::version = "1.47.0"]
180185
pub BLANKET_CLIPPY_RESTRICTION_LINTS,
181186
suspicious,
182187
"enabling the complete restriction group"
@@ -208,6 +213,7 @@ declare_clippy_lint! {
208213
/// #[rustfmt::skip]
209214
/// fn main() { }
210215
/// ```
216+
#[clippy::version = "1.32.0"]
211217
pub DEPRECATED_CFG_ATTR,
212218
complexity,
213219
"usage of `cfg_attr(rustfmt)` instead of tool attributes"
@@ -240,6 +246,7 @@ declare_clippy_lint! {
240246
/// fn conditional() { }
241247
/// ```
242248
/// Check the [Rust Reference](https://doc.rust-lang.org/reference/conditional-compilation.html#target_os) for more details.
249+
#[clippy::version = "1.45.0"]
243250
pub MISMATCHED_TARGET_OS,
244251
correctness,
245252
"usage of `cfg(operating_system)` instead of `cfg(target_os = \"operating_system\")`"

clippy_lints/src/await_holding_invalid.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ declare_clippy_lint! {
4747
/// bar.await;
4848
/// }
4949
/// ```
50+
#[clippy::version = "1.45.0"]
5051
pub AWAIT_HOLDING_LOCK,
5152
pedantic,
5253
"Inside an async function, holding a MutexGuard while calling await"
@@ -88,6 +89,7 @@ declare_clippy_lint! {
8889
/// bar.await;
8990
/// }
9091
/// ```
92+
#[clippy::version = "1.49.0"]
9193
pub AWAIT_HOLDING_REFCELL_REF,
9294
pedantic,
9395
"Inside an async function, holding a RefCell ref while calling await"

0 commit comments

Comments
 (0)