diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-05-08 22:45:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-08 22:45:06 -0400 |
commit | 47f7bed677a6b72e873712de8f3988ea891710e4 (patch) | |
tree | 096549459b479cf1383e65c87b77e9f9482df258 /cli/tools/fmt.rs | |
parent | e6dc4dfbff25e77d2127591802229b4a74037d24 (diff) |
chore: enable clippy::print_stdout and clippy::print_stderr (#23732)
1. Generally we should prefer to use the `log` crate.
2. I very often accidentally commit `eprintln`s.
When we should use `println` or `eprintln`, it's not too bad to be a bit
more verbose and ignore the lint rule.
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r-- | cli/tools/fmt.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs index b16639f99..ef3d48cb5 100644 --- a/cli/tools/fmt.rs +++ b/cli/tools/fmt.rs @@ -396,8 +396,8 @@ async fn format_source_files( } Err(e) => { let _g = output_lock.lock(); - eprintln!("Error formatting: {}", file_path.to_string_lossy()); - eprintln!(" {e}"); + log::error!("Error formatting: {}", file_path.to_string_lossy()); + log::error!(" {e}"); } } Ok(()) @@ -495,6 +495,7 @@ fn format_stdin(fmt_options: FmtOptions, ext: &str) -> Result<(), AnyError> { let file_path = PathBuf::from(format!("_stdin.{ext}")); let formatted_text = format_file(&file_path, &source, &fmt_options.options)?; if fmt_options.check { + #[allow(clippy::print_stdout)] if formatted_text.is_some() { println!("Not formatted stdin"); } |