Don't pass --write-mode argument to rustc
Fixes regression introduced by
660f41865b
This commit is contained in:
parent
660f41865b
commit
ce25165450
1 changed files with 12 additions and 14 deletions
|
@ -93,38 +93,36 @@ fn determine_params<I>(args: I) -> Option<(Vec<String>, WriteMode)>
|
||||||
let help_mode = "-h";
|
let help_mode = "-h";
|
||||||
let long_help_mode = "--help";
|
let long_help_mode = "--help";
|
||||||
let mut write_mode = WriteMode::Replace;
|
let mut write_mode = WriteMode::Replace;
|
||||||
let args: Vec<String> = args.collect();
|
let mut rustc_args = Vec::new();
|
||||||
|
|
||||||
// The NewFile option currently isn't supported because it requires another
|
// The NewFile option currently isn't supported because it requires another
|
||||||
// parameter, but it can be added later.
|
// parameter, but it can be added later.
|
||||||
if args.iter().any(|arg| {
|
for arg in args {
|
||||||
if arg.starts_with(write_mode_prefix) {
|
if arg.starts_with(write_mode_prefix) {
|
||||||
write_mode = match FromStr::from_str(&arg[write_mode_prefix.len()..]) {
|
match FromStr::from_str(&arg[write_mode_prefix.len()..]) {
|
||||||
Ok(mode) => mode,
|
Ok(mode) => write_mode = mode,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
print_usage("Unrecognized write mode");
|
print_usage("Unrecognized write mode");
|
||||||
return true;
|
return None;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
false
|
|
||||||
} else if arg.starts_with(help_mode) || arg.starts_with(long_help_mode) {
|
} else if arg.starts_with(help_mode) || arg.starts_with(long_help_mode) {
|
||||||
print_usage("");
|
print_usage("");
|
||||||
true
|
return None;
|
||||||
} else if arg.starts_with(arg_prefix) {
|
} else if arg.starts_with(arg_prefix) {
|
||||||
print_usage("Invalid argument");
|
print_usage("Invalid argument");
|
||||||
true
|
return None;
|
||||||
} else {
|
} else {
|
||||||
false
|
// Pass everything else to rustc
|
||||||
|
rustc_args.push(arg);
|
||||||
}
|
}
|
||||||
}) {
|
|
||||||
return None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.len() < 2 {
|
if rustc_args.len() < 2 {
|
||||||
print_usage("Please provide a file to be formatted");
|
print_usage("Please provide a file to be formatted");
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Some((args, write_mode))
|
Some((rustc_args, write_mode))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue