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/registry/diagnostics.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/registry/diagnostics.rs')
-rw-r--r-- | cli/tools/registry/diagnostics.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/cli/tools/registry/diagnostics.rs b/cli/tools/registry/diagnostics.rs index 38366ed7e..31f815767 100644 --- a/cli/tools/registry/diagnostics.rs +++ b/cli/tools/registry/diagnostics.rs @@ -38,7 +38,11 @@ impl PublishDiagnosticsCollector { diagnostics.sort_by_cached_key(|d| d.sorting_key()); for diagnostic in diagnostics { - eprint!("{}", diagnostic.display()); + // todo(https://github.com/denoland/deno_ast/issues/245): use log crate here + #[allow(clippy::print_stderr)] + { + eprint!("{}", diagnostic.display()); + } if matches!(diagnostic.level(), DiagnosticLevel::Error) { errors += 1; } @@ -48,18 +52,18 @@ impl PublishDiagnosticsCollector { } if errors > 0 { if has_slow_types_errors { - eprintln!( + log::error!( "This package contains errors for slow types. Fixing these errors will:\n" ); - eprintln!( + log::error!( " 1. Significantly improve your package users' type checking performance." ); - eprintln!(" 2. Improve the automatic documentation generation."); - eprintln!(" 3. Enable automatic .d.ts generation for Node.js."); - eprintln!( + log::error!(" 2. Improve the automatic documentation generation."); + log::error!(" 3. Enable automatic .d.ts generation for Node.js."); + log::error!( "\nDon't want to bother? You can choose to skip this step by" ); - eprintln!("providing the --allow-slow-types flag.\n"); + log::error!("providing the --allow-slow-types flag.\n"); } Err(anyhow!( |