diff --git a/crates/ruff_server/src/fix.rs b/crates/ruff_server/src/fix.rs index 6690279da020a..b1c7a61fe6bd5 100644 --- a/crates/ruff_server/src/fix.rs +++ b/crates/ruff_server/src/fix.rs @@ -69,8 +69,7 @@ pub(crate) fn fix_all( let FixerResult { transformed, result: LinterResult { - has_syntax_error: has_error, - .. + has_syntax_error, .. }, .. } = ruff_linter::linter::lint_fix( @@ -83,9 +82,9 @@ pub(crate) fn fix_all( source_type, )?; - if has_error { - // abort early if a parsing error occurred - return Err(anyhow::anyhow!("A parsing error occurred during `fix_all`")); + if has_syntax_error { + // If there's a syntax error, then there won't be any fixes to apply. + return Ok(Fixes::default()); } // fast path: if `transformed` is still borrowed, no changes were made and we can return early