From d1c7a07d2ae56f4ff56b81c7f2a398e2262c42b9 Mon Sep 17 00:00:00 2001 From: konstin Date: Fri, 2 Jun 2023 16:46:05 +0200 Subject: [PATCH] more rebase fallout --- crates/ruff/src/autofix/codemods.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ruff/src/autofix/codemods.rs b/crates/ruff/src/autofix/codemods.rs index 8d8ab05295912..d08bf12f706c2 100644 --- a/crates/ruff/src/autofix/codemods.rs +++ b/crates/ruff/src/autofix/codemods.rs @@ -127,7 +127,11 @@ pub(crate) fn remove_imports<'a>( } } - Ok(Some(tree.codegen_stylist(&stylist))) + if aliases.is_empty() { + return Ok(None); + } + + Ok(Some(tree.codegen_stylist(stylist))) } /// Given an import statement, remove any imports that are not specified in the `imports` slice.