Skip to content

Commit 050cdd6

Browse files
committed
Auto merge of rust-lang#8872 - hellow554:dependency_update, r=llogiq
update dependencies changelog: none Updating some dependencies, but the biggest one is clap to v3, but without using the derive struct thingy.
2 parents 3642e33 + 9b55ea7 commit 050cdd6

File tree

6 files changed

+89
-107
lines changed

6 files changed

+89
-107
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tempfile = { version = "3.2", optional = true }
2828
termize = "0.1"
2929

3030
[dev-dependencies]
31-
compiletest_rs = { version = "0.7.1", features = ["tmp"] }
31+
compiletest_rs = { version = "0.8", features = ["tmp"] }
3232
tester = "0.9"
3333
regex = "1.5"
3434
# This is used by the `collect-metadata` alias.
@@ -48,7 +48,7 @@ quote = "1.0"
4848
serde = { version = "1.0.125", features = ["derive"] }
4949
syn = { version = "1.0", features = ["full"] }
5050
futures = "0.3"
51-
parking_lot = "0.11.2"
51+
parking_lot = "0.12"
5252
tokio = { version = "1", features = ["io-util"] }
5353
rustc-semver = "1.1"
5454

clippy_dev/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55

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

clippy_dev/src/main.rs

+70-86
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
// warn on lints, that are included in `rust-lang/rust`s bootstrap
33
#![warn(rust_2018_idioms, unused_lifetimes)]
44

5-
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
5+
use clap::{Arg, ArgMatches, Command};
66
use clippy_dev::{bless, fmt, lint, new_lint, serve, setup, update_lints};
77
use indoc::indoc;
88
fn main() {
99
let matches = get_clap_config();
1010

1111
match matches.subcommand() {
12-
("bless", Some(matches)) => {
12+
Some(("bless", matches)) => {
1313
bless::bless(matches.is_present("ignore-timestamp"));
1414
},
15-
("fmt", Some(matches)) => {
15+
Some(("fmt", matches)) => {
1616
fmt::run(matches.is_present("check"), matches.is_present("verbose"));
1717
},
18-
("update_lints", Some(matches)) => {
18+
Some(("update_lints", matches)) => {
1919
if matches.is_present("print-only") {
2020
update_lints::print_lints();
2121
} else if matches.is_present("check") {
@@ -24,7 +24,7 @@ fn main() {
2424
update_lints::update(update_lints::UpdateMode::Change);
2525
}
2626
},
27-
("new_lint", Some(matches)) => {
27+
Some(("new_lint", matches)) => {
2828
match new_lint::create(
2929
matches.value_of("pass"),
3030
matches.value_of("name"),
@@ -35,8 +35,8 @@ fn main() {
3535
Err(e) => eprintln!("Unable to create lint: {}", e),
3636
}
3737
},
38-
("setup", Some(sub_command)) => match sub_command.subcommand() {
39-
("intellij", Some(matches)) => {
38+
Some(("setup", sub_command)) => match sub_command.subcommand() {
39+
Some(("intellij", matches)) => {
4040
if matches.is_present("remove") {
4141
setup::intellij::remove_rustc_src();
4242
} else {
@@ -47,14 +47,14 @@ fn main() {
4747
);
4848
}
4949
},
50-
("git-hook", Some(matches)) => {
50+
Some(("git-hook", matches)) => {
5151
if matches.is_present("remove") {
5252
setup::git_hook::remove_hook();
5353
} else {
5454
setup::git_hook::install_hook(matches.is_present("force-override"));
5555
}
5656
},
57-
("vscode-tasks", Some(matches)) => {
57+
Some(("vscode-tasks", matches)) => {
5858
if matches.is_present("remove") {
5959
setup::vscode::remove_tasks();
6060
} else {
@@ -63,23 +63,23 @@ fn main() {
6363
},
6464
_ => {},
6565
},
66-
("remove", Some(sub_command)) => match sub_command.subcommand() {
67-
("git-hook", Some(_)) => setup::git_hook::remove_hook(),
68-
("intellij", Some(_)) => setup::intellij::remove_rustc_src(),
69-
("vscode-tasks", Some(_)) => setup::vscode::remove_tasks(),
66+
Some(("remove", sub_command)) => match sub_command.subcommand() {
67+
Some(("git-hook", _)) => setup::git_hook::remove_hook(),
68+
Some(("intellij", _)) => setup::intellij::remove_rustc_src(),
69+
Some(("vscode-tasks", _)) => setup::vscode::remove_tasks(),
7070
_ => {},
7171
},
72-
("serve", Some(matches)) => {
72+
Some(("serve", matches)) => {
7373
let port = matches.value_of("port").unwrap().parse().unwrap();
7474
let lint = matches.value_of("lint");
7575
serve::run(port, lint);
7676
},
77-
("lint", Some(matches)) => {
77+
Some(("lint", matches)) => {
7878
let path = matches.value_of("path").unwrap();
7979
let args = matches.values_of("args").into_iter().flatten();
8080
lint::run(path, args);
8181
},
82-
("rename_lint", Some(matches)) => {
82+
Some(("rename_lint", matches)) => {
8383
let old_name = matches.value_of("old_name").unwrap();
8484
let new_name = matches.value_of("new_name").unwrap_or(old_name);
8585
let uplift = matches.is_present("uplift");
@@ -89,35 +89,24 @@ fn main() {
8989
}
9090
}
9191

92-
fn get_clap_config<'a>() -> ArgMatches<'a> {
93-
App::new("Clippy developer tooling")
94-
.setting(AppSettings::ArgRequiredElseHelp)
92+
fn get_clap_config() -> ArgMatches {
93+
Command::new("Clippy developer tooling")
94+
.arg_required_else_help(true)
9595
.subcommand(
96-
SubCommand::with_name("bless")
97-
.about("bless the test output changes")
98-
.arg(
99-
Arg::with_name("ignore-timestamp")
100-
.long("ignore-timestamp")
101-
.help("Include files updated before clippy was built"),
102-
),
96+
Command::new("bless").about("bless the test output changes").arg(
97+
Arg::new("ignore-timestamp")
98+
.long("ignore-timestamp")
99+
.help("Include files updated before clippy was built"),
100+
),
103101
)
104102
.subcommand(
105-
SubCommand::with_name("fmt")
103+
Command::new("fmt")
106104
.about("Run rustfmt on all projects and tests")
107-
.arg(
108-
Arg::with_name("check")
109-
.long("check")
110-
.help("Use the rustfmt --check option"),
111-
)
112-
.arg(
113-
Arg::with_name("verbose")
114-
.short("v")
115-
.long("verbose")
116-
.help("Echo commands run"),
117-
),
105+
.arg(Arg::new("check").long("check").help("Use the rustfmt --check option"))
106+
.arg(Arg::new("verbose").short('v').long("verbose").help("Echo commands run")),
118107
)
119108
.subcommand(
120-
SubCommand::with_name("update_lints")
109+
Command::new("update_lints")
121110
.about("Updates lint registration and information from the source code")
122111
.long_about(
123112
"Makes sure that:\n \
@@ -127,40 +116,40 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
127116
* lint modules in `clippy_lints/*` are visible in `src/lib.rs` via `pub mod`\n \
128117
* all lints are registered in the lint store",
129118
)
130-
.arg(Arg::with_name("print-only").long("print-only").help(
119+
.arg(Arg::new("print-only").long("print-only").help(
131120
"Print a table of lints to STDOUT. \
132121
This does not include deprecated and internal lints. \
133122
(Does not modify any files)",
134123
))
135124
.arg(
136-
Arg::with_name("check")
125+
Arg::new("check")
137126
.long("check")
138127
.help("Checks that `cargo dev update_lints` has been run. Used on CI."),
139128
),
140129
)
141130
.subcommand(
142-
SubCommand::with_name("new_lint")
131+
Command::new("new_lint")
143132
.about("Create new lint and run `cargo dev update_lints`")
144133
.arg(
145-
Arg::with_name("pass")
146-
.short("p")
134+
Arg::new("pass")
135+
.short('p')
147136
.long("pass")
148137
.help("Specify whether the lint runs during the early or late pass")
149138
.takes_value(true)
150139
.possible_values(&["early", "late"])
151140
.required(true),
152141
)
153142
.arg(
154-
Arg::with_name("name")
155-
.short("n")
143+
Arg::new("name")
144+
.short('n')
156145
.long("name")
157146
.help("Name of the new lint in snake case, ex: fn_too_long")
158147
.takes_value(true)
159148
.required(true),
160149
)
161150
.arg(
162-
Arg::with_name("category")
163-
.short("c")
151+
Arg::new("category")
152+
.short('c')
164153
.long("category")
165154
.help("What category the lint belongs to")
166155
.default_value("nursery")
@@ -179,29 +168,25 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
179168
])
180169
.takes_value(true),
181170
)
182-
.arg(
183-
Arg::with_name("msrv")
184-
.long("msrv")
185-
.help("Add MSRV config code to the lint"),
186-
),
171+
.arg(Arg::new("msrv").long("msrv").help("Add MSRV config code to the lint")),
187172
)
188173
.subcommand(
189-
SubCommand::with_name("setup")
174+
Command::new("setup")
190175
.about("Support for setting up your personal development environment")
191-
.setting(AppSettings::ArgRequiredElseHelp)
176+
.arg_required_else_help(true)
192177
.subcommand(
193-
SubCommand::with_name("intellij")
178+
Command::new("intellij")
194179
.about("Alter dependencies so Intellij Rust can find rustc internals")
195180
.arg(
196-
Arg::with_name("remove")
181+
Arg::new("remove")
197182
.long("remove")
198183
.help("Remove the dependencies added with 'cargo dev setup intellij'")
199184
.required(false),
200185
)
201186
.arg(
202-
Arg::with_name("rustc-repo-path")
187+
Arg::new("rustc-repo-path")
203188
.long("repo-path")
204-
.short("r")
189+
.short('r')
205190
.help("The path to a rustc repo that will be used for setting the dependencies")
206191
.takes_value(true)
207192
.value_name("path")
@@ -210,66 +195,65 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
210195
),
211196
)
212197
.subcommand(
213-
SubCommand::with_name("git-hook")
198+
Command::new("git-hook")
214199
.about("Add a pre-commit git hook that formats your code to make it look pretty")
215200
.arg(
216-
Arg::with_name("remove")
201+
Arg::new("remove")
217202
.long("remove")
218203
.help("Remove the pre-commit hook added with 'cargo dev setup git-hook'")
219204
.required(false),
220205
)
221206
.arg(
222-
Arg::with_name("force-override")
207+
Arg::new("force-override")
223208
.long("force-override")
224-
.short("f")
209+
.short('f')
225210
.help("Forces the override of an existing git pre-commit hook")
226211
.required(false),
227212
),
228213
)
229214
.subcommand(
230-
SubCommand::with_name("vscode-tasks")
215+
Command::new("vscode-tasks")
231216
.about("Add several tasks to vscode for formatting, validation and testing")
232217
.arg(
233-
Arg::with_name("remove")
218+
Arg::new("remove")
234219
.long("remove")
235220
.help("Remove the tasks added with 'cargo dev setup vscode-tasks'")
236221
.required(false),
237222
)
238223
.arg(
239-
Arg::with_name("force-override")
224+
Arg::new("force-override")
240225
.long("force-override")
241-
.short("f")
226+
.short('f')
242227
.help("Forces the override of existing vscode tasks")
243228
.required(false),
244229
),
245230
),
246231
)
247232
.subcommand(
248-
SubCommand::with_name("remove")
233+
Command::new("remove")
249234
.about("Support for undoing changes done by the setup command")
250-
.setting(AppSettings::ArgRequiredElseHelp)
251-
.subcommand(SubCommand::with_name("git-hook").about("Remove any existing pre-commit git hook"))
252-
.subcommand(SubCommand::with_name("vscode-tasks").about("Remove any existing vscode tasks"))
235+
.arg_required_else_help(true)
236+
.subcommand(Command::new("git-hook").about("Remove any existing pre-commit git hook"))
237+
.subcommand(Command::new("vscode-tasks").about("Remove any existing vscode tasks"))
253238
.subcommand(
254-
SubCommand::with_name("intellij")
255-
.about("Removes rustc source paths added via `cargo dev setup intellij`"),
239+
Command::new("intellij").about("Removes rustc source paths added via `cargo dev setup intellij`"),
256240
),
257241
)
258242
.subcommand(
259-
SubCommand::with_name("serve")
243+
Command::new("serve")
260244
.about("Launch a local 'ALL the Clippy Lints' website in a browser")
261245
.arg(
262-
Arg::with_name("port")
246+
Arg::new("port")
263247
.long("port")
264-
.short("p")
248+
.short('p')
265249
.help("Local port for the http server")
266250
.default_value("8000")
267251
.validator_os(serve::validate_port),
268252
)
269-
.arg(Arg::with_name("lint").help("Which lint's page to load initially (optional)")),
253+
.arg(Arg::new("lint").help("Which lint's page to load initially (optional)")),
270254
)
271255
.subcommand(
272-
SubCommand::with_name("lint")
256+
Command::new("lint")
273257
.about("Manually run clippy on a file or package")
274258
.after_help(indoc! {"
275259
EXAMPLES
@@ -288,33 +272,33 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
288272
cargo dev lint ~/my-project -- -- -W clippy::pedantic
289273
"})
290274
.arg(
291-
Arg::with_name("path")
275+
Arg::new("path")
292276
.required(true)
293277
.help("The path to a file or package directory to lint"),
294278
)
295279
.arg(
296-
Arg::with_name("args")
297-
.multiple(true)
280+
Arg::new("args")
281+
.multiple_occurrences(true)
298282
.help("Pass extra arguments to cargo/clippy-driver"),
299283
),
300284
)
301285
.subcommand(
302-
SubCommand::with_name("rename_lint")
286+
Command::new("rename_lint")
303287
.about("Renames the given lint")
304288
.arg(
305-
Arg::with_name("old_name")
289+
Arg::new("old_name")
306290
.index(1)
307291
.required(true)
308292
.help("The name of the lint to rename"),
309293
)
310294
.arg(
311-
Arg::with_name("new_name")
295+
Arg::new("new_name")
312296
.index(2)
313-
.required_unless("uplift")
297+
.required_unless_present("uplift")
314298
.help("The new name of the lint"),
315299
)
316300
.arg(
317-
Arg::with_name("uplift")
301+
Arg::new("uplift")
318302
.long("uplift")
319303
.help("This lint will be uplifted into rustc"),
320304
),

0 commit comments

Comments
 (0)