Skip to content

Commit

Permalink
Don't print config file by default (rust-lang#1313)
Browse files Browse the repository at this point in the history
Supress `Using rusftmt config file...` messages unless the --verbose
flag is given.
  • Loading branch information
casey authored and nrc committed Feb 12, 2017
1 parent fad74c8 commit 4f939dd
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/bin/rustfmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -234,8 +234,11 @@ fn execute(opts: &Options) -> FmtResult<Summary> {
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();
Expand All @@ -244,10 +247,12 @@ fn execute(opts: &Options) -> FmtResult<Summary> {
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;
}
Expand Down

0 comments on commit 4f939dd

Please sign in to comment.