Skip to content

Commit 3155eed

Browse files
committed
Don't use an exact lint counter anymore
1 parent 5de0190 commit 3155eed

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
77

8-
[There are 363 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
8+
[There are over 363 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
99

1010
We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you:
1111

clippy_dev/src/update_lints.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn run(update_mode: UpdateMode) {
1717
let internal_lints = Lint::internal_lints(lint_list.clone().into_iter());
1818

1919
let usable_lints: Vec<Lint> = Lint::usable_lints(lint_list.clone().into_iter()).collect();
20-
let usable_lint_count = usable_lints.len();
20+
let usable_lint_count = round_to_fifty(usable_lints.len());
2121

2222
let mut sorted_usable_lints = usable_lints.clone();
2323
sorted_usable_lints.sort_by_key(|lint| lint.name.clone());
@@ -29,27 +29,26 @@ pub fn run(update_mode: UpdateMode) {
2929
false,
3030
update_mode == UpdateMode::Change,
3131
|| {
32-
format!(
33-
"pub const ALL_LINTS: [Lint; {}] = {:#?};",
34-
sorted_usable_lints.len(),
35-
sorted_usable_lints
36-
)
37-
.lines()
38-
.map(ToString::to_string)
39-
.collect::<Vec<_>>()
32+
format!("pub static ref ALL_LINTS: Vec<Lint> = vec!{:#?};", sorted_usable_lints)
33+
.lines()
34+
.map(ToString::to_string)
35+
.collect::<Vec<_>>()
4036
},
4137
)
4238
.changed;
4339

4440
file_change |= replace_region_in_file(
4541
Path::new("README.md"),
46-
&format!(r#"\[There are \d+ lints included in this crate!\]\({}\)"#, DOCS_LINK),
42+
&format!(
43+
r#"\[There are over \d+ lints included in this crate!\]\({}\)"#,
44+
DOCS_LINK
45+
),
4746
"",
4847
true,
4948
update_mode == UpdateMode::Change,
5049
|| {
5150
vec![format!(
52-
"[There are {} lints included in this crate!]({})",
51+
"[There are over {} lints included in this crate!]({})",
5352
usable_lint_count, DOCS_LINK
5453
)]
5554
},
@@ -161,3 +160,7 @@ pub fn print_lints() {
161160

162161
println!("there are {} lints", usable_lint_count);
163162
}
163+
164+
fn round_to_fifty(count: usize) -> usize {
165+
count / 50 * 50
166+
}

src/lintlist/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
//! This file is managed by `cargo dev update_lints`. Do not edit.
22
3+
use lazy_static::lazy_static;
4+
35
pub mod lint;
46
pub use lint::Level;
57
pub use lint::Lint;
68
pub use lint::LINT_LEVELS;
79

10+
lazy_static! {
811
// begin lint list, do not remove this comment, it’s used in `update_lints`
9-
pub const ALL_LINTS: [Lint; 363] = [
12+
pub static ref ALL_LINTS: Vec<Lint> = vec![
1013
Lint {
1114
name: "absurd_extreme_comparisons",
1215
group: "correctness",
@@ -2550,3 +2553,4 @@ pub const ALL_LINTS: [Lint; 363] = [
25502553
},
25512554
];
25522555
// end lint list, do not remove this comment, it’s used in `update_lints`
2556+
}

0 commit comments

Comments
 (0)