Skip to content

Commit fe70f6d

Browse files
committed
Create new lints with #[clippy::version = "nightly"]
1 parent 5c031d1 commit fe70f6d

File tree

19 files changed

+48
-47
lines changed

19 files changed

+48
-47
lines changed

book/src/development/adding_lints.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ declare_clippy_lint! {
223223
/// ```rust
224224
/// // example code
225225
/// ```
226-
#[clippy::version = "1.29.0"]
226+
#[clippy::version = "nightly"]
227227
pub FOO_FUNCTIONS,
228228
pedantic,
229229
"function named `foo`, which is not a descriptive name"
@@ -577,7 +577,7 @@ declare_clippy_lint! {
577577
/// ```rust,ignore
578578
/// // A short example of improved code that doesn't trigger the lint
579579
/// ```
580-
#[clippy::version = "1.29.0"]
580+
#[clippy::version = "nightly"]
581581
pub FOO_FUNCTIONS,
582582
pedantic,
583583
"function named `foo`, which is not a descriptive name"

book/src/development/defining_lints.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ declare_clippy_lint! {
169169
/// ```rust
170170
/// // example code which does not raise Clippy warning
171171
/// ```
172-
#[clippy::version = "1.70.0"] // <- In which version was this implemented, keep it up to date!
172+
#[clippy::version = "nightly"]
173173
pub LINT_NAME, // <- The lint name IN_ALL_CAPS
174174
pedantic, // <- The lint group
175-
"default lint description" // <- A lint description, e.g. "A function has an unit return type."
175+
"default lint description" // <- A lint description, e.g. "A function has an unit return type"
176176
}
177177
```
178178

book/src/development/infrastructure/changelog_update.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ that label in the changelog. If you can, remove the `beta-accepted` labels
111111
112112
### 4. Update `clippy::version` attributes
113113

114-
Next, make sure to check that the `#[clippy::version]` attributes for the added
115-
lints contain the correct version.
114+
Next, make sure to check that the `#[clippy::version]` attributes for the newly
115+
added, renamed and deprecated lints contain the correct version.
116116

117117
[changelog]: https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md
118118
[forge]: https://forge.rust-lang.org/

clippy_dev/src/new_lint.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{clippy_project_root, clippy_version};
1+
use crate::utils::clippy_project_root;
22
use clap::ValueEnum;
33
use indoc::{formatdoc, writedoc};
44
use std::fmt::{self, Write as _};
@@ -193,11 +193,6 @@ fn to_camel_case(name: &str) -> String {
193193
.collect()
194194
}
195195

196-
pub(crate) fn get_stabilization_version() -> String {
197-
let (minor, patch) = clippy_version();
198-
format!("{minor}.{patch}.0")
199-
}
200-
201196
fn get_test_file_contents(lint_name: &str, msrv: bool) -> String {
202197
let mut test = formatdoc!(
203198
r"
@@ -351,13 +346,12 @@ fn get_lint_declaration(name_upper: &str, category: &str) -> String {
351346
/// ```no_run
352347
/// // example code which does not raise clippy warning
353348
/// ```
354-
#[clippy::version = "{}"]
349+
#[clippy::version = "nightly"]
355350
pub {name_upper},
356351
{category},
357352
"default lint description"
358353
}}
359354
"#,
360-
get_stabilization_version(),
361355
)
362356
}
363357

clippy_dev/src/update_lints.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,12 @@ pub fn rename(old_name: &str, new_name: &str, uplift: bool) {
197197
});
198198
}
199199

200-
let version = crate::new_lint::get_stabilization_version();
201200
rewrite_file(Path::new("clippy_lints/src/deprecated_lints.rs"), |s| {
202201
insert_at_marker(
203202
s,
204203
"// end renamed lints. used by `cargo dev rename_lint`",
205204
&format!(
206-
"#[clippy::version = \"{version}\"]\n \
205+
"#[clippy::version = \"nightly\"]\n \
207206
(\"{}\", \"{}\"),\n ",
208207
lint.old_name, lint.new_name,
209208
),
@@ -333,12 +332,11 @@ pub fn deprecate(name: &str, reason: &str) {
333332
let deprecated_lints_path = &*clippy_project_root().join("clippy_lints/src/deprecated_lints.rs");
334333

335334
if remove_lint_declaration(stripped_name, &mod_path, &mut lints).unwrap_or(false) {
336-
let version = crate::new_lint::get_stabilization_version();
337335
rewrite_file(deprecated_lints_path, |s| {
338336
insert_at_marker(
339337
s,
340338
"// end deprecated lints. used by `cargo dev deprecate_lint`",
341-
&format!("#[clippy::version = \"{version}\"]\n (\"{prefixed_name}\", \"{reason}\"),\n ",),
339+
&format!("#[clippy::version = \"nightly\"]\n (\"{prefixed_name}\", \"{reason}\"),\n ",),
342340
)
343341
});
344342

clippy_lints/src/deprecated_lints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ declare_with_version! { DEPRECATED(DEPRECATED_VERSION): &[(&str, &str)] = &[
4040
("clippy::pub_enum_variant_names", "`clippy::enum_variant_names` now covers this case via the `avoid-breaking-exported-api` config"),
4141
#[clippy::version = "1.54.0"]
4242
("clippy::wrong_pub_self_convention", "`clippy::wrong_self_convention` now covers this case via the `avoid-breaking-exported-api` config"),
43-
#[clippy::version = "1.86.0"]
43+
#[clippy::version = "nightly"]
4444
("clippy::option_map_or_err_ok", "`clippy::manual_ok_or` covers this case"),
4545
// end deprecated lints. used by `cargo dev deprecate_lint`
4646
]}
@@ -131,7 +131,7 @@ declare_with_version! { RENAMED(RENAMED_VERSION): &[(&str, &str)] = &[
131131
("clippy::clone_double_ref", "suspicious_double_ref_op"),
132132
#[clippy::version = ""]
133133
("clippy::cmp_nan", "invalid_nan_comparisons"),
134-
#[clippy::version = "1.86.0"]
134+
#[clippy::version = "nightly"]
135135
("clippy::double_neg", "double_negations"),
136136
#[clippy::version = ""]
137137
("clippy::drop_bounds", "drop_bounds"),

clippy_lints/src/doc/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ declare_clippy_lint! {
9898
/// ```no_run
9999
/// //! <code>[first](x)second</code>
100100
/// ```
101-
#[clippy::version = "1.86.0"]
101+
#[clippy::version = "nightly"]
102102
pub DOC_LINK_CODE,
103103
nursery,
104104
"link with code back-to-back with other code"
@@ -475,7 +475,7 @@ declare_clippy_lint! {
475475
/// /// and this line is overindented.
476476
/// # fn foo() {}
477477
/// ```
478-
#[clippy::version = "1.86.0"]
478+
#[clippy::version = "nightly"]
479479
pub DOC_OVERINDENTED_LIST_ITEMS,
480480
style,
481481
"ensure list items are not overindented"

clippy_lints/src/loops/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ declare_clippy_lint! {
734734
/// let mut some_slice = [1, 2, 3, 4, 5];
735735
/// some_slice.fill(0);
736736
/// ```
737-
#[clippy::version = "1.86.0"]
737+
#[clippy::version = "nightly"]
738738
pub MANUAL_SLICE_FILL,
739739
style,
740740
"manually filling a slice with a value"

clippy_lints/src/matches/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ declare_clippy_lint! {
10001000
/// let a = func().ok();
10011001
/// let b = func().err();
10021002
/// ```
1003-
#[clippy::version = "1.86.0"]
1003+
#[clippy::version = "nightly"]
10041004
pub MANUAL_OK_ERR,
10051005
complexity,
10061006
"find manual implementations of `.ok()` or `.err()` on `Result`"

clippy_lints/src/mem_replace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ declare_clippy_lint! {
6262
/// let mut an_option = Some(0);
6363
/// let taken = an_option.replace(1);
6464
/// ```
65-
#[clippy::version = "1.86.0"]
65+
#[clippy::version = "nightly"]
6666
pub MEM_REPLACE_OPTION_WITH_SOME,
6767
style,
6868
"replacing an `Option` with `Some` instead of `replace()`"

0 commit comments

Comments
 (0)