Skip to content

Commit 2bd1581

Browse files
committed
Add dev deprecate
1 parent 93c6f9e commit 2bd1581

File tree

9 files changed

+474
-69
lines changed

9 files changed

+474
-69
lines changed

clippy_dev/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55

66
[dependencies]
77
aho-corasick = "0.7"
8-
clap = "3.1"
8+
clap = "3.2"
99
indoc = "1.0"
1010
itertools = "0.10.1"
1111
opener = "0.5"

clippy_dev/src/main.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use clap::{Arg, ArgAction, ArgMatches, Command, PossibleValue};
66
use clippy_dev::{bless, fmt, lint, new_lint, serve, setup, update_lints};
77
use indoc::indoc;
8+
89
fn main() {
910
let matches = get_clap_config();
1011

@@ -85,6 +86,11 @@ fn main() {
8586
let uplift = matches.contains_id("uplift");
8687
update_lints::rename(old_name, new_name, uplift);
8788
},
89+
Some(("deprecate", matches)) => {
90+
let name = matches.get_one::<String>("name").unwrap();
91+
let reason = matches.get_one("reason");
92+
update_lints::deprecate(name, reason);
93+
},
8894
_ => {},
8995
}
9096
}
@@ -266,6 +272,18 @@ fn get_clap_config() -> ArgMatches {
266272
.long("uplift")
267273
.help("This lint will be uplifted into rustc"),
268274
]),
275+
Command::new("deprecate").about("Deprecates the given lint").args([
276+
Arg::new("name")
277+
.index(1)
278+
.required(true)
279+
.help("The name of the lint to deprecate"),
280+
Arg::new("reason")
281+
.long("reason")
282+
.short('r')
283+
.required(false)
284+
.takes_value(true)
285+
.help("The reason for deprecation"),
286+
]),
269287
])
270288
.get_matches()
271289
}

clippy_dev/src/new_lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fn to_camel_case(name: &str) -> String {
138138
.collect()
139139
}
140140

141-
fn get_stabilization_version() -> String {
141+
pub(crate) fn get_stabilization_version() -> String {
142142
fn parse_manifest(contents: &str) -> Option<String> {
143143
let version = contents
144144
.lines()

0 commit comments

Comments
 (0)