From d7b331bea79361642e016b61ba2cd174410d450b Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Thu, 19 Nov 2015 17:56:37 -0800 Subject: [PATCH] Use argv[0] for usage output Usage messages traditionally use this as it contains the path that the user provided to run the executable (e.g. `rustfmt` instead of `/usr/local/bin/rustfmt`). --- src/bin/rustfmt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/rustfmt.rs b/src/bin/rustfmt.rs index 789f8773345..d5b34d98b2d 100644 --- a/src/bin/rustfmt.rs +++ b/src/bin/rustfmt.rs @@ -164,7 +164,7 @@ fn main() { fn print_usage(opts: &Options, reason: &str) { let reason = format!("{}\nusage: {} [options] ...", reason, - env::current_exe().unwrap().display()); + env::args_os().next().unwrap().to_string_lossy()); println!("{}", opts.usage(&reason)); }