diff options
| author | flip1995 <hello@philkrones.com> | 2020-03-31 17:23:14 +0200 |
|---|---|---|
| committer | flip1995 <hello@philkrones.com> | 2020-03-31 17:24:09 +0200 |
| commit | 3155eedb68b4aaefe89731b3e1c788453cee1f80 (patch) | |
| tree | e350183624465cb76c096255a932c229baef052e /clippy_dev | |
| parent | 5de019074b08d4625ab9e24280071a270e9b8eef (diff) | |
| download | rust-3155eedb68b4aaefe89731b3e1c788453cee1f80.tar.gz rust-3155eedb68b4aaefe89731b3e1c788453cee1f80.zip | |
Don't use an exact lint counter anymore
Diffstat (limited to 'clippy_dev')
| -rw-r--r-- | clippy_dev/src/update_lints.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/clippy_dev/src/update_lints.rs b/clippy_dev/src/update_lints.rs index f6fc322431c..d30d6f97a2f 100644 --- a/clippy_dev/src/update_lints.rs +++ b/clippy_dev/src/update_lints.rs @@ -17,7 +17,7 @@ pub fn run(update_mode: UpdateMode) { let internal_lints = Lint::internal_lints(lint_list.clone().into_iter()); let usable_lints: Vec<Lint> = Lint::usable_lints(lint_list.clone().into_iter()).collect(); - let usable_lint_count = usable_lints.len(); + let usable_lint_count = round_to_fifty(usable_lints.len()); let mut sorted_usable_lints = usable_lints.clone(); sorted_usable_lints.sort_by_key(|lint| lint.name.clone()); @@ -29,27 +29,26 @@ pub fn run(update_mode: UpdateMode) { false, update_mode == UpdateMode::Change, || { - format!( - "pub const ALL_LINTS: [Lint; {}] = {:#?};", - sorted_usable_lints.len(), - sorted_usable_lints - ) - .lines() - .map(ToString::to_string) - .collect::<Vec<_>>() + format!("pub static ref ALL_LINTS: Vec<Lint> = vec!{:#?};", sorted_usable_lints) + .lines() + .map(ToString::to_string) + .collect::<Vec<_>>() }, ) .changed; file_change |= replace_region_in_file( Path::new("README.md"), - &format!(r#"\[There are \d+ lints included in this crate!\]\({}\)"#, DOCS_LINK), + &format!( + r#"\[There are over \d+ lints included in this crate!\]\({}\)"#, + DOCS_LINK + ), "", true, update_mode == UpdateMode::Change, || { vec", + "[There are over {} lints included in this crate!]({})", usable_lint_count, DOCS_LINK )] }, @@ -161,3 +160,7 @@ pub fn print_lints() { println!("there are {} lints", usable_lint_count); } + +fn round_to_fifty(count: usize) -> usize { + count / 50 * 50 +} |
