Fix CLI of clippy_dev

Clap was updated in rust-lang/rust-clippy#10270, which broke the command
line of clippy_dev. This swaps out contains_id, which now returns always
true in the places it was used with get_flag.
This commit is contained in:
Philipp Krones 2023-02-10 11:38:56 +01:00
parent 5adeebf92f
commit fabada0c81
No known key found for this signature in database
GPG Key ID: 1CA0DF2AF59D68A5

View File

@ -11,22 +11,22 @@ fn main() {
match matches.subcommand() { match matches.subcommand() {
Some(("bless", matches)) => { Some(("bless", matches)) => {
bless::bless(matches.contains_id("ignore-timestamp")); bless::bless(matches.get_flag("ignore-timestamp"));
}, },
Some(("dogfood", matches)) => { Some(("dogfood", matches)) => {
dogfood::dogfood( dogfood::dogfood(
matches.contains_id("fix"), matches.get_flag("fix"),
matches.contains_id("allow-dirty"), matches.get_flag("allow-dirty"),
matches.contains_id("allow-staged"), matches.get_flag("allow-staged"),
); );
}, },
Some(("fmt", matches)) => { Some(("fmt", matches)) => {
fmt::run(matches.contains_id("check"), matches.contains_id("verbose")); fmt::run(matches.get_flag("check"), matches.get_flag("verbose"));
}, },
Some(("update_lints", matches)) => { Some(("update_lints", matches)) => {
if matches.contains_id("print-only") { if matches.get_flag("print-only") {
update_lints::print_lints(); update_lints::print_lints();
} else if matches.contains_id("check") { } else if matches.get_flag("check") {
update_lints::update(update_lints::UpdateMode::Check); update_lints::update(update_lints::UpdateMode::Check);
} else { } else {
update_lints::update(update_lints::UpdateMode::Change); update_lints::update(update_lints::UpdateMode::Change);
@ -38,7 +38,7 @@ fn main() {
matches.get_one::<String>("name"), matches.get_one::<String>("name"),
matches.get_one::<String>("category").map(String::as_str), matches.get_one::<String>("category").map(String::as_str),
matches.get_one::<String>("type").map(String::as_str), matches.get_one::<String>("type").map(String::as_str),
matches.contains_id("msrv"), matches.get_flag("msrv"),
) { ) {
Ok(_) => update_lints::update(update_lints::UpdateMode::Change), Ok(_) => update_lints::update(update_lints::UpdateMode::Change),
Err(e) => eprintln!("Unable to create lint: {e}"), Err(e) => eprintln!("Unable to create lint: {e}"),
@ -46,7 +46,7 @@ fn main() {
}, },
Some(("setup", sub_command)) => match sub_command.subcommand() { Some(("setup", sub_command)) => match sub_command.subcommand() {
Some(("intellij", matches)) => { Some(("intellij", matches)) => {
if matches.contains_id("remove") { if matches.get_flag("remove") {
setup::intellij::remove_rustc_src(); setup::intellij::remove_rustc_src();
} else { } else {
setup::intellij::setup_rustc_src( setup::intellij::setup_rustc_src(
@ -57,17 +57,17 @@ fn main() {
} }
}, },
Some(("git-hook", matches)) => { Some(("git-hook", matches)) => {
if matches.contains_id("remove") { if matches.get_flag("remove") {
setup::git_hook::remove_hook(); setup::git_hook::remove_hook();
} else { } else {
setup::git_hook::install_hook(matches.contains_id("force-override")); setup::git_hook::install_hook(matches.get_flag("force-override"));
} }
}, },
Some(("vscode-tasks", matches)) => { Some(("vscode-tasks", matches)) => {
if matches.contains_id("remove") { if matches.get_flag("remove") {
setup::vscode::remove_tasks(); setup::vscode::remove_tasks();
} else { } else {
setup::vscode::install_tasks(matches.contains_id("force-override")); setup::vscode::install_tasks(matches.get_flag("force-override"));
} }
}, },
_ => {}, _ => {},
@ -91,7 +91,7 @@ fn main() {
Some(("rename_lint", matches)) => { Some(("rename_lint", matches)) => {
let old_name = matches.get_one::<String>("old_name").unwrap(); let old_name = matches.get_one::<String>("old_name").unwrap();
let new_name = matches.get_one::<String>("new_name").unwrap_or(old_name); let new_name = matches.get_one::<String>("new_name").unwrap_or(old_name);
let uplift = matches.contains_id("uplift"); let uplift = matches.get_flag("uplift");
update_lints::rename(old_name, new_name, uplift); update_lints::rename(old_name, new_name, uplift);
}, },
Some(("deprecate", matches)) => { Some(("deprecate", matches)) => {