RIIR update_lints: Replace lint count in README.md
This allows the usage of `util/dev update_lints` which will write the new lint_count to the `README.md`.
This commit is contained in:
@@ -32,6 +32,8 @@ fn main() {
|
||||
if let Some(matches) = matches.subcommand_matches("update_lints") {
|
||||
if matches.is_present("print-only") {
|
||||
print_lints();
|
||||
} else {
|
||||
update_lints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,3 +57,21 @@ fn print_lints() {
|
||||
|
||||
println!("there are {} lints", lint_count);
|
||||
}
|
||||
|
||||
fn update_lints() {
|
||||
let lint_list = gather_all();
|
||||
let usable_lints: Vec<Lint> = Lint::usable_lints(lint_list).collect();
|
||||
let lint_count = usable_lints.len();
|
||||
|
||||
replace_region_in_file(
|
||||
"../README.md",
|
||||
r#"\[There are \d+ lints included in this crate!\]\(https://rust-lang-nursery.github.io/rust-clippy/master/index.html\)"#,
|
||||
"",
|
||||
true,
|
||||
|| {
|
||||
vec", lint_count)
|
||||
]
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user