Skip to content

Commit 2893a21

Browse files
committed
tidy: Clean up argument handling
Use `.nth(n)` rather than `.skip(n).next()` (also fixes a clippy warning), and use `.into()` and a type signature rather than `PathBuf::from`.
1 parent 0f40a12 commit 2893a21

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/tools/tidy/src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ use std::path::PathBuf;
2424
use std::env;
2525

2626
fn main() {
27-
let path = env::args_os().skip(1).next().expect("need path to src");
28-
let path = PathBuf::from(path);
29-
30-
let cargo = env::args_os().skip(2).next().expect("need path to cargo");
31-
let cargo = PathBuf::from(cargo);
27+
let path: PathBuf = env::args_os().nth(1).expect("need path to src").into();
28+
let cargo: PathBuf = env::args_os().nth(2).expect("need path to cargo").into();
3229

3330
let args: Vec<String> = env::args().skip(1).collect();
3431

0 commit comments

Comments
 (0)