chore(rustfmt): remove executable path from usage string (#5216)
* chore(rustfmt): remove executable path from usage string * add unit test for usage string * rename test and check usage text in a single assert
This commit is contained in:
parent
813d127c82
commit
b05b313800
@ -394,9 +394,8 @@ fn print_usage_to_stdout(opts: &Options, reason: &str) {
|
||||
format!("{}\n\n", reason)
|
||||
};
|
||||
let msg = format!(
|
||||
"{}Format Rust code\n\nusage: {} [options] <file>...",
|
||||
sep,
|
||||
env::args_os().next().unwrap().to_string_lossy()
|
||||
"{}Format Rust code\n\nusage: rustfmt [options] <file>...",
|
||||
sep
|
||||
);
|
||||
println!("{}", opts.usage(&msg));
|
||||
}
|
||||
|
@ -106,3 +106,12 @@ fn inline_config() {
|
||||
&& contains("format_strings = true")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rustfmt_usage_text() {
|
||||
let args = [
|
||||
"--help",
|
||||
];
|
||||
let (stdout, _) = rustfmt(&args);
|
||||
assert!(stdout.contains(&format!("Format Rust code\n\nusage: rustfmt [options] <file>...")));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user