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/repl | |
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/repl')
-rw-r--r-- | cli/tools/repl/editor.rs | 2 | ||||
-rw-r--r-- | cli/tools/repl/mod.rs | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/cli/tools/repl/editor.rs b/cli/tools/repl/editor.rs index 9cb3cd1c2..dbc9bce70 100644 --- a/cli/tools/repl/editor.rs +++ b/cli/tools/repl/editor.rs @@ -490,7 +490,7 @@ impl ReplEditor { } self.errored_on_history_save.store(true, Relaxed); - eprintln!("Unable to save history file: {e}"); + log::warn!("Unable to save history file: {}", e); } } } diff --git a/cli/tools/repl/mod.rs b/cli/tools/repl/mod.rs index 8847bee52..c29e29e71 100644 --- a/cli/tools/repl/mod.rs +++ b/cli/tools/repl/mod.rs @@ -40,6 +40,7 @@ struct Repl { message_handler: RustylineSyncMessageHandler, } +#[allow(clippy::print_stdout)] impl Repl { async fn run(&mut self) -> Result<(), AnyError> { loop { @@ -61,7 +62,7 @@ impl Repl { break; } - println!("{output}"); + println!("{}", output); } Err(ReadlineError::Interrupted) => { if self.editor.should_exit_on_interrupt() { @@ -75,7 +76,7 @@ impl Repl { break; } Err(err) => { - println!("Error: {err:?}"); + println!("Error: {:?}", err); break; } } @@ -85,6 +86,7 @@ impl Repl { } } +#[allow(clippy::print_stdout)] async fn read_line_and_poll( repl_session: &mut ReplSession, message_handler: &mut RustylineSyncMessageHandler, @@ -152,6 +154,7 @@ async fn read_eval_file( Ok(file.into_text_decoded()?.source) } +#[allow(clippy::print_stdout)] pub async fn run(flags: Flags, repl_flags: ReplFlags) -> Result<i32, AnyError> { let factory = CliFactory::from_flags(flags)?; let cli_options = factory.cli_options(); |