about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2015-11-19 17:56:37 -0800
committerSteven Fackler <sfackler@gmail.com>2015-11-19 17:56:37 -0800
commitd7b331bea79361642e016b61ba2cd174410d450b (patch)
tree09cf3b762867c68e8b2b5112b2ae8774bf501e63 /src
parentf09aa85798232d294fdb266a6f1f27995dad2be3 (diff)
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`).
Diffstat (limited to 'src')
-rw-r--r--src/bin/rustfmt.rs2
1 files changed, 1 insertions, 1 deletions
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] <file>...",
                          reason,
-                         env::current_exe().unwrap().display());
+                         env::args_os().next().unwrap().to_string_lossy());
     println!("{}", opts.usage(&reason));
 }