diff --git a/crates/ruff_python_formatter/src/lib.rs b/crates/ruff_python_formatter/src/lib.rs index 92e404d15c..39ac5ed30d 100644 --- a/crates/ruff_python_formatter/src/lib.rs +++ b/crates/ruff_python_formatter/src/lib.rs @@ -54,7 +54,13 @@ where if self.is_suppressed(node_comments.trailing, f.context()) { suppressed_node(node.as_any_node_ref()).fmt(f) } else { - leading_comments(node_comments.leading).fmt(f)?; + write!( + f, + [ + leading_comments(node_comments.leading), + source_position(node.start()) + ] + )?; self.fmt_fields(node, f)?; self.fmt_dangling_comments(node_comments.dangling, f)?;