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/args/flags.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/args/flags.rs')
-rw-r--r-- | cli/args/flags.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 0ef02be39..dca9cfa49 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -3889,6 +3889,7 @@ fn eval_parse(flags: &mut Flags, matches: &mut ArgMatches) { // TODO(@satyarohith): remove this flag in 2.0. let as_typescript = matches.get_flag("ts"); + #[allow(clippy::print_stderr)] if as_typescript { eprintln!( "⚠️ {}", @@ -4218,6 +4219,8 @@ fn test_parse(flags: &mut Flags, matches: &mut ArgMatches) { let no_run = matches.get_flag("no-run"); let trace_leaks = matches.get_flag("trace-ops") || matches.get_flag("trace-leaks"); + + #[allow(clippy::print_stderr)] if trace_leaks && matches.get_flag("trace-ops") { // We can't change this to use the log crate because its not configured // yet at this point since the flags haven't been parsed. This flag is @@ -4267,10 +4270,17 @@ fn test_parse(flags: &mut Flags, matches: &mut ArgMatches) { // yet at this point since the flags haven't been parsed. This flag is // deprecated though so it's not worth changing the code to use the log // crate here and this is only done for testing anyway. - eprintln!( - "⚠️ {}", - crate::colors::yellow("The `--jobs` flag is deprecated and will be removed in Deno 2.0.\nUse the `--parallel` flag with possibly the `DENO_JOBS` environment variable instead.\nLearn more at: https://docs.deno.com/runtime/manual/basics/env_variables"), - ); + #[allow(clippy::print_stderr)] + { + eprintln!( + "⚠️ {}", + crate::colors::yellow(concat!( + "The `--jobs` flag is deprecated and will be removed in Deno 2.0.\n", + "Use the `--parallel` flag with possibly the `DENO_JOBS` environment variable instead.\n", + "Learn more at: https://docs.deno.com/runtime/manual/basics/env_variables" + )), + ); + } if let Some(value) = matches.remove_one::<NonZeroUsize>("jobs") { Some(value) } else { |