diff options
| author | Lzu Tao <taolzu@gmail.com> | 2020-02-06 21:28:50 +0700 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2020-02-07 08:33:05 +0700 |
| commit | 344603afcef264bc1790bca6865dbfb4815d2d5d (patch) | |
| tree | 03ba044431f944bc74049953b4d4171a24d58c87 /clippy_dev | |
| parent | 729f943c53586013c7306e0485565fd089964fa3 (diff) | |
| download | rust-344603afcef264bc1790bca6865dbfb4815d2d5d.tar.gz rust-344603afcef264bc1790bca6865dbfb4815d2d5d.zip | |
dev: Make UpdateMode a copy type
Diffstat (limited to 'clippy_dev')
| -rw-r--r-- | clippy_dev/src/main.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs index 7369db1f078..403aa634c34 100644 --- a/clippy_dev/src/main.rs +++ b/clippy_dev/src/main.rs @@ -8,7 +8,7 @@ mod fmt; mod new_lint; mod stderr_length_check; -#[derive(PartialEq)] +#[derive(Clone, Copy, PartialEq)] enum UpdateMode { Check, Change, @@ -113,9 +113,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); } }, ("new_lint", Some(matches)) => { @@ -124,7 +124,7 @@ fn main() { matches.value_of("name"), matches.value_of("category"), ) { - Ok(_) => update_lints(&UpdateMode::Change), + Ok(_) => update_lints(UpdateMode::Change), Err(e) => eprintln!("Unable to create lint: {}", e), } }, @@ -161,7 +161,7 @@ fn print_lints() { } #[allow(clippy::too_many_lines)] -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(); @@ -175,7 +175,7 @@ fn update_lints(update_mode: &UpdateMode) { "begin lint list", "end lint list", false, - update_mode == &UpdateMode::Change, + update_mode == UpdateMode::Change, || { format!( "pub const ALL_LINTS: [Lint; {}] = {:#?};", @@ -194,7 +194,7 @@ fn update_lints(update_mode: &UpdateMode) { r#"\[There are \d+ lints included in this crate!\]\(https://rust-lang.github.io/rust-clippy/master/index.html\)"#, "", true, - update_mode == &UpdateMode::Change, + update_mode == UpdateMode::Change, || { vec", lint_count) @@ -207,7 +207,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; @@ -217,7 +217,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; @@ -227,7 +227,7 @@ fn update_lints(update_mode: &UpdateMode) { "begin register lints", "end register lints", false, - update_mode == &UpdateMode::Change, + update_mode == UpdateMode::Change, || gen_register_lint_list(&lint_list), ) .changed; @@ -237,7 +237,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; @@ -248,7 +248,7 @@ fn update_lints(update_mode: &UpdateMode) { r#"store.register_group\(true, "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 @@ -271,13 +271,13 @@ fn update_lints(update_mode: &UpdateMode) { &format!("store.register_group\\(true, \"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 `cargo dev update_lints` to make sure all lints are defined properly." |
