From 4f939ddf0c9344da646367d46810eb1ac92c5780 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 12 Feb 2017 15:50:10 -0800 Subject: [PATCH] Don't print config file by default (#1313) Supress `Using rusftmt config file...` messages unless the --verbose flag is given. --- src/bin/rustfmt.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/bin/rustfmt.rs b/src/bin/rustfmt.rs index ab41fbb7de7..9d66154a814 100644 --- a/src/bin/rustfmt.rs +++ b/src/bin/rustfmt.rs @@ -170,7 +170,7 @@ fn make_opts() -> Options { let mut opts = Options::new(); opts.optflag("h", "help", "show this message"); opts.optflag("V", "version", "show version information"); - opts.optflag("v", "verbose", "show progress"); + opts.optflag("v", "verbose", "print verbose output"); opts.optopt("", "write-mode", "mode to write in (not usable when piping from stdin)", @@ -234,8 +234,11 @@ fn execute(opts: &Options) -> FmtResult { config = cfg_tmp; path = path_tmp; }; - if let Some(path) = path.as_ref() { - println!("Using rustfmt config file {}", path.display()); + + if options.verbose { + if let Some(path) = path.as_ref() { + println!("Using rustfmt config file {}", path.display()); + } } let mut error_summary = Summary::new(); @@ -244,10 +247,12 @@ fn execute(opts: &Options) -> FmtResult { if path.is_none() { let (config_tmp, path_tmp) = resolve_config(file.parent().unwrap()) .expect(&format!("Error resolving config for {}", file.display())); - if let Some(path) = path_tmp.as_ref() { - println!("Using rustfmt config file {} for {}", - path.display(), - file.display()); + if options.verbose { + if let Some(path) = path_tmp.as_ref() { + println!("Using rustfmt config file {} for {}", + path.display(), + file.display()); + } } config = config_tmp; }