Skip to content

Commit d647696

Browse files
committed
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 -.-
1 parent 63cb410 commit d647696

File tree

235 files changed

+490
-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.

235 files changed

+490
-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 = "pre 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 = "pre 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 = "pre 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 = "pre 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 = "pre 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 = "pre 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
@@ -66,6 +66,7 @@ declare_clippy_lint! {
6666
/// #[inline(always)]
6767
/// fn not_quite_hot_code(..) { ... }
6868
/// ```
69+
#[clippy::version = "pre 1.29.0"]
6970
pub INLINE_ALWAYS,
7071
pedantic,
7172
"use of `#[inline(always)]`"
@@ -100,6 +101,7 @@ declare_clippy_lint! {
100101
/// #[macro_use]
101102
/// extern crate baz;
102103
/// ```
104+
#[clippy::version = "pre 1.29.0"]
103105
pub USELESS_ATTRIBUTE,
104106
correctness,
105107
"use of lint attributes on `extern crate` items"
@@ -119,6 +121,7 @@ declare_clippy_lint! {
119121
/// #[deprecated(since = "forever")]
120122
/// fn something_else() { /* ... */ }
121123
/// ```
124+
#[clippy::version = "pre 1.29.0"]
122125
pub DEPRECATED_SEMVER,
123126
correctness,
124127
"use of `#[deprecated(since = \"x\")]` where x is not semver"
@@ -156,6 +159,7 @@ declare_clippy_lint! {
156159
/// #[allow(dead_code)]
157160
/// fn this_is_fine_too() { }
158161
/// ```
162+
#[clippy::version = "pre 1.29.0"]
159163
pub EMPTY_LINE_AFTER_OUTER_ATTR,
160164
nursery,
161165
"empty line after outer attribute"
@@ -179,6 +183,7 @@ declare_clippy_lint! {
179183
/// ```rust
180184
/// #![deny(clippy::as_conversions)]
181185
/// ```
186+
#[clippy::version = "1.47.0"]
182187
pub BLANKET_CLIPPY_RESTRICTION_LINTS,
183188
suspicious,
184189
"enabling the complete restriction group"
@@ -210,6 +215,7 @@ declare_clippy_lint! {
210215
/// #[rustfmt::skip]
211216
/// fn main() { }
212217
/// ```
218+
#[clippy::version = "1.32.0"]
213219
pub DEPRECATED_CFG_ATTR,
214220
complexity,
215221
"usage of `cfg_attr(rustfmt)` instead of tool attributes"
@@ -242,6 +248,7 @@ declare_clippy_lint! {
242248
/// fn conditional() { }
243249
/// ```
244250
/// Check the [Rust Reference](https://doc.rust-lang.org/reference/conditional-compilation.html#target_os) for more details.
251+
#[clippy::version = "1.45.0"]
245252
pub MISMATCHED_TARGET_OS,
246253
correctness,
247254
"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)