diff --git a/crates/ruff_cli/src/commands/format.rs b/crates/ruff_cli/src/commands/format.rs index dc63c795a8..36530b9772 100644 --- a/crates/ruff_cli/src/commands/format.rs +++ b/crates/ruff_cli/src/commands/format.rs @@ -32,7 +32,7 @@ pub(crate) fn format(cli: &Arguments, overrides: &Overrides) -> Result Result true, - Err(err) => { - // The inner errors are all flat, i.e., none of them has a source. - #[allow(clippy::print_stderr)] - { - eprintln!("{}", err.to_string().red().bold()); - } - false + if let Err(err) = result.as_ref() { + // The inner errors are all flat, i.e., none of them has a source. + #[allow(clippy::print_stderr)] + { + eprintln!("{}", err.to_string().red().bold()); } } + result }) - .all(|success| success); + .collect::, _>>(); - if all_success { + if result.is_ok() { Ok(ExitStatus::Success) } else { Ok(ExitStatus::Error)