From 47f7bed677a6b72e873712de8f3988ea891710e4 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 8 May 2024 22:45:06 -0400 Subject: 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. --- cli/util/file_watcher.rs | 4 +++- cli/util/v8.rs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'cli/util') diff --git a/cli/util/file_watcher.rs b/cli/util/file_watcher.rs index 50ae7c233..247ae49d8 100644 --- a/cli/util/file_watcher.rs +++ b/cli/util/file_watcher.rs @@ -73,6 +73,7 @@ impl DebouncedReceiver { } } +#[allow(clippy::print_stderr)] async fn error_handler(watch_future: F) -> bool where F: Future>, @@ -132,8 +133,9 @@ fn create_print_after_restart_fn( clear_screen: bool, ) -> impl Fn() { move || { + #[allow(clippy::print_stderr)] if clear_screen && std::io::stderr().is_terminal() { - eprint!("{CLEAR_SCREEN}"); + eprint!("{}", CLEAR_SCREEN); } info!( "{} File change detected! Restarting!", diff --git a/cli/util/v8.rs b/cli/util/v8.rs index 63bc495d1..a8ab2c3d0 100644 --- a/cli/util/v8.rs +++ b/cli/util/v8.rs @@ -43,6 +43,8 @@ pub fn init_v8_flags( .into_iter() .skip(1) .collect::>(); + + #[allow(clippy::print_stderr)] if !unrecognized_v8_flags.is_empty() { for f in unrecognized_v8_flags { eprintln!("error: V8 did not recognize flag '{f}'"); -- cgit v1.2.3