mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-15 00:13:02 +00:00
Drop only the first occurrence of fmt
while preparing CLI arguments
This commit is contained in:
parent
32fbe75a4c
commit
a7afdeb9b8
@ -62,7 +62,16 @@ const FAILURE: i32 = 1;
|
||||
|
||||
fn execute() -> i32 {
|
||||
// Drop extra `fmt` argument provided by `cargo`.
|
||||
let args = env::args().filter(|x| x != "fmt");
|
||||
let mut found_fmt = false;
|
||||
let args = env::args().filter(|x| {
|
||||
if found_fmt {
|
||||
true
|
||||
} else {
|
||||
found_fmt = x == "fmt";
|
||||
x != "fmt"
|
||||
}
|
||||
});
|
||||
|
||||
let opts = Opts::from_iter(args);
|
||||
|
||||
let verbosity = match (opts.verbose, opts.quiet) {
|
||||
|
Loading…
Reference in New Issue
Block a user