diff --git a/crates/ruff_python_formatter/src/lib.rs b/crates/ruff_python_formatter/src/lib.rs index 2762063dca16f9..7697789fe072c0 100644 --- a/crates/ruff_python_formatter/src/lib.rs +++ b/crates/ruff_python_formatter/src/lib.rs @@ -206,13 +206,13 @@ if True: #[test] fn quick_test() { let source = r#" -def f(): - # fmt: off - +def main() -> None: if True: - with_semicolon = 20 \ - ; # comment - + some_very_long_variable_name_abcdefghijk = Foo() + some_very_long_variable_name_abcdefghijk = some_very_long_variable_name_abcdefghijk[ + some_very_long_variable_name_abcdefghijk.some_very_long_attribute_name + == "This is a very long string abcdefghijk" + ] "#; let source_type = PySourceType::Python; diff --git a/crates/ruff_python_formatter/src/verbatim.rs b/crates/ruff_python_formatter/src/verbatim.rs index 99e8e22e2de19a..5c29b0039d2b56 100644 --- a/crates/ruff_python_formatter/src/verbatim.rs +++ b/crates/ruff_python_formatter/src/verbatim.rs @@ -400,7 +400,7 @@ fn write_suppressed_statements<'a>( let end = loop { if let Some(comment) = comments.trailing(current).last() { break comment.end(); - } else if let Some(child) = AnyNodeRef::from(current).last_child_in_body() { + } else if let Some(child) = current.last_child_in_body() { current = child; } else { break trailing_semicolon(current, source)