diff --git a/crates/ruff/resources/test/fixtures/isort/force_single_line.py b/crates/ruff/resources/test/fixtures/isort/force_single_line.py index 3aadd3e436..b9bcf502d0 100644 --- a/crates/ruff/resources/test/fixtures/isort/force_single_line.py +++ b/crates/ruff/resources/test/fixtures/isort/force_single_line.py @@ -10,9 +10,10 @@ from third_party import lib4 from foo import bar # comment 3 from foo2 import bar2 # comment 4 +from foo3 import bar3, baz3 # comment 5 -# comment 5 +# comment 6 from bar import ( - a, # comment 6 - b, # comment 7 -) \ No newline at end of file + a, # comment 7 + b, # comment 8 +) diff --git a/crates/ruff/src/rules/isort/mod.rs b/crates/ruff/src/rules/isort/mod.rs index bbbc0f7a6e..5df3c20a1a 100644 --- a/crates/ruff/src/rules/isort/mod.rs +++ b/crates/ruff/src/rules/isort/mod.rs @@ -94,7 +94,7 @@ fn force_single_line_imports<'a>( } else { CommentSet { atop: vec![], - inline: vec![], + inline: comment_set.inline.clone(), } }, TrailingComma::Absent, diff --git a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_single_line_force_single_line.py.snap b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_single_line_force_single_line.py.snap index c2b87e78af..276ca31a43 100644 --- a/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_single_line_force_single_line.py.snap +++ b/crates/ruff/src/rules/isort/snapshots/ruff__rules__isort__tests__force_single_line_force_single_line.py.snap @@ -11,15 +11,15 @@ expression: diagnostics row: 1 column: 0 end_location: - row: 19 + row: 20 column: 0 fix: - content: "import math\nimport sys\nfrom logging.handlers import FileHandler, StreamHandler\nfrom os import path, uname\n\n# comment 5\nfrom bar import a # comment 6\nfrom bar import b # comment 7\nfrom foo import bar # comment 3\nfrom foo2 import bar2 # comment 4\n\n# comment 1\n# comment 2\nfrom third_party import lib1\nfrom third_party import lib2\nfrom third_party import lib3\nfrom third_party import lib4\nfrom third_party import lib5\nfrom third_party import lib6\nfrom third_party import lib7\n" + content: "import math\nimport sys\nfrom logging.handlers import FileHandler, StreamHandler\nfrom os import path, uname\n\n# comment 6\nfrom bar import a # comment 7\nfrom bar import b # comment 8\nfrom foo import bar # comment 3\nfrom foo2 import bar2 # comment 4\nfrom foo3 import bar3 # comment 5\nfrom foo3 import baz3 # comment 5\n\n# comment 1\n# comment 2\nfrom third_party import lib1\nfrom third_party import lib2\nfrom third_party import lib3\nfrom third_party import lib4\nfrom third_party import lib5\nfrom third_party import lib6\nfrom third_party import lib7\n" location: row: 1 column: 0 end_location: - row: 19 + row: 20 column: 0 parent: ~