Skip to content

Commit

Permalink
Auto merge of #8625 - Jarcho:rename_lint, r=xFrednet
Browse files Browse the repository at this point in the history
Add `cargo dev rename_lint`

fixes #7799

changelog: None
  • Loading branch information
bors committed Apr 30, 2022
2 parents ec46992 + b3de32b commit 32fe476
Show file tree
Hide file tree
Showing 11 changed files with 646 additions and 267 deletions.
1 change: 1 addition & 0 deletions clippy_dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.0.1"
edition = "2021"

[dependencies]
aho-corasick = "0.7"
clap = "2.33"
indoc = "1.0"
itertools = "0.10.1"
Expand Down
1 change: 1 addition & 0 deletions clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(let_chains)]
#![feature(let_else)]
#![feature(once_cell)]
#![feature(rustc_private)]
Expand Down
33 changes: 30 additions & 3 deletions clippy_dev/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ fn main() {
if matches.is_present("print-only") {
update_lints::print_lints();
} else if matches.is_present("check") {
update_lints::run(update_lints::UpdateMode::Check);
update_lints::update(update_lints::UpdateMode::Check);
} else {
update_lints::run(update_lints::UpdateMode::Change);
update_lints::update(update_lints::UpdateMode::Change);
}
},
("new_lint", Some(matches)) => {
Expand All @@ -31,7 +31,7 @@ fn main() {
matches.value_of("category"),
matches.is_present("msrv"),
) {
Ok(_) => update_lints::run(update_lints::UpdateMode::Change),
Ok(_) => update_lints::update(update_lints::UpdateMode::Change),
Err(e) => eprintln!("Unable to create lint: {}", e),
}
},
Expand Down Expand Up @@ -78,6 +78,12 @@ fn main() {
let path = matches.value_of("path").unwrap();
lint::run(path);
},
("rename_lint", Some(matches)) => {
let old_name = matches.value_of("old_name").unwrap();
let new_name = matches.value_of("new_name").unwrap_or(old_name);
let uplift = matches.is_present("uplift");
update_lints::rename(old_name, new_name, uplift);
},
_ => {},
}
}
Expand Down Expand Up @@ -279,5 +285,26 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
.help("The path to a file or package directory to lint"),
),
)
.subcommand(
SubCommand::with_name("rename_lint")
.about("Renames the given lint")
.arg(
Arg::with_name("old_name")
.index(1)
.required(true)
.help("The name of the lint to rename"),
)
.arg(
Arg::with_name("new_name")
.index(2)
.required_unless("uplift")
.help("The new name of the lint"),
)
.arg(
Arg::with_name("uplift")
.long("uplift")
.help("This lint will be uplifted into rustc"),
),
)
.get_matches()
}
Loading

0 comments on commit 32fe476

Please sign in to comment.