Fix dogfood

This commit is contained in:
Philipp Hansch 2018-11-05 07:11:25 +01:00
parent 5b24f23020
commit 745a619657
No known key found for this signature in database
GPG Key ID: B6FA06A6E0E2665B
1 changed files with 10 additions and 10 deletions

View File

@ -48,9 +48,9 @@ fn main() {
if matches.is_present("print-only") {
print_lints();
} else if matches.is_present("check") {
update_lints(UpdateMode::Check);
update_lints(&UpdateMode::Check);
} else {
update_lints(UpdateMode::Change);
update_lints(&UpdateMode::Change);
}
}
}
@ -75,7 +75,7 @@ fn print_lints() {
println!("there are {} lints", lint_count);
}
fn update_lints(update_mode: UpdateMode) {
fn update_lints(update_mode: &UpdateMode) {
let lint_list: Vec<Lint> = gather_all().collect();
let usable_lints: Vec<Lint> = Lint::usable_lints(lint_list.clone().into_iter()).collect();
let lint_count = usable_lints.len();
@ -85,7 +85,7 @@ fn update_lints(update_mode: UpdateMode) {
r#"\[There are \d+ lints included in this crate!\]\(https://rust-lang-nursery.github.io/rust-clippy/master/index.html\)"#,
"",
true,
update_mode == UpdateMode::Change,
update_mode == &UpdateMode::Change,
|| {
vec![
format!("[There are {} lints included in this crate!](https://rust-lang-nursery.github.io/rust-clippy/master/index.html)", lint_count)
@ -98,7 +98,7 @@ fn update_lints(update_mode: UpdateMode) {
"<!-- begin autogenerated links to lint list -->",
"<!-- end autogenerated links to lint list -->",
false,
update_mode == UpdateMode::Change,
update_mode == &UpdateMode::Change,
|| { gen_changelog_lint_list(lint_list.clone()) }
).changed;
@ -107,7 +107,7 @@ fn update_lints(update_mode: UpdateMode) {
"begin deprecated lints",
"end deprecated lints",
false,
update_mode == UpdateMode::Change,
update_mode == &UpdateMode::Change,
|| { gen_deprecated(&lint_list) }
).changed;
@ -116,7 +116,7 @@ fn update_lints(update_mode: UpdateMode) {
"begin lints modules",
"end lints modules",
false,
update_mode == UpdateMode::Change,
update_mode == &UpdateMode::Change,
|| { gen_modules_list(lint_list.clone()) }
).changed;
@ -126,7 +126,7 @@ fn update_lints(update_mode: UpdateMode) {
r#"reg.register_lint_group\("clippy::all""#,
r#"\]\);"#,
false,
update_mode == UpdateMode::Change,
update_mode == &UpdateMode::Change,
|| {
// clippy::all should only include the following lint groups:
let all_group_lints = usable_lints.clone().into_iter().filter(|l| {
@ -147,12 +147,12 @@ fn update_lints(update_mode: UpdateMode) {
&format!("reg.register_lint_group\\(\"clippy::{}\"", lint_group),
r#"\]\);"#,
false,
update_mode == UpdateMode::Change,
update_mode == &UpdateMode::Change,
|| { gen_lint_group_list(lints.clone()) }
).changed;
}
if update_mode == UpdateMode::Check && file_change {
if update_mode == &UpdateMode::Check && file_change {
println!("Not all lints defined properly. Please run `util/dev update_lints` to make sure all lints are defined properly.");
std::process::exit(1);
}