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/main.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/main.rs')
-rw-r--r-- | cli/main.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cli/main.rs b/cli/main.rs index 3b103e780..4f866ee21 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -235,6 +235,7 @@ async fn run_subcommand(flags: Flags) -> Result<i32, AnyError> { handle.await? } +#[allow(clippy::print_stderr)] fn setup_panic_hook() { // This function does two things inside of the panic hook: // - Tokio does not exit the process when a task panics, so we define a custom @@ -259,6 +260,7 @@ fn setup_panic_hook() { })); } +#[allow(clippy::print_stderr)] fn exit_with_message(message: &str, code: i32) -> ! { eprintln!( "{}: {}", @@ -289,6 +291,7 @@ fn exit_for_error(error: AnyError) -> ! { exit_with_message(&error_string, error_code); } +#[allow(clippy::print_stderr)] pub(crate) fn unstable_exit_cb(feature: &str, api_name: &str) { eprintln!( "Unstable API '{api_name}'. The `--unstable-{}` flag must be provided.", @@ -298,6 +301,7 @@ pub(crate) fn unstable_exit_cb(feature: &str, api_name: &str) { } // TODO(bartlomieju): remove when `--unstable` flag is removed. +#[allow(clippy::print_stderr)] pub(crate) fn unstable_warn_cb(feature: &str, api_name: &str) { eprintln!( "⚠️ {}", @@ -369,7 +373,9 @@ fn resolve_flags_and_init( // TODO(bartlomieju): remove when `--unstable` flag is removed. if flags.unstable_config.legacy_flag_enabled { + #[allow(clippy::print_stderr)] if matches!(flags.subcommand, DenoSubcommand::Check(_)) { + // can't use log crate because that's not setup yet eprintln!( "⚠️ {}", colors::yellow( |