From db5004f2003486aa78751a5dd5bf2989824e724e Mon Sep 17 00:00:00 2001 From: Yusuke Tanaka Date: Sun, 20 Sep 2020 20:49:22 +0900 Subject: fix(fmt,lint): do not print number of checked files when `--quiet` is enabled (#7579) --- cli/fmt.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cli/fmt.rs') diff --git a/cli/fmt.rs b/cli/fmt.rs index 2a8845290..d989ac1ad 100644 --- a/cli/fmt.rs +++ b/cli/fmt.rs @@ -78,13 +78,13 @@ async fn check_source_files( let _g = output_lock.lock().unwrap(); match diff(&file_text, &formatted_text) { Ok(diff) => { - println!(); - println!( + info!(""); + info!( "{} {}:", colors::bold("from"), file_path.display().to_string() ); - println!("{}", diff); + info!("{}", diff); } Err(e) => { eprintln!( @@ -113,7 +113,7 @@ async fn check_source_files( let checked_files_str = format!("{} {}", checked_files_count, files_str(checked_files_count)); if not_formatted_files_count == 0 { - println!("Checked {}", checked_files_str); + info!("Checked {}", checked_files_str); Ok(()) } else { let not_formatted_files_str = files_str(not_formatted_files_count); @@ -151,7 +151,7 @@ async fn format_source_files( )?; formatted_files_count.fetch_add(1, Ordering::Relaxed); let _g = output_lock.lock().unwrap(); - println!("{}", file_path.to_string_lossy()); + info!("{}", file_path.to_string_lossy()); } } Err(e) => { @@ -173,7 +173,7 @@ async fn format_source_files( ); let checked_files_count = checked_files_count.load(Ordering::Relaxed); - println!( + info!( "Checked {} {}", checked_files_count, files_str(checked_files_count) @@ -211,7 +211,7 @@ fn format_stdin(check: bool) -> Result<(), AnyError> { } fn files_str(len: usize) -> &'static str { - if len == 1 { + if len <= 1 { "file" } else { "files" -- cgit v1.2.3