mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-12 14:48:16 +00:00
Attach dangling comments to the comprehension instead of the if
or iter
nodes (#7693)
This commit is contained in:
parent
e62e245c61
commit
e2ec42539b
13 changed files with 124 additions and 22 deletions
|
@ -85,6 +85,11 @@ where
|
|||
dangling_node_comments: &[SourceComment],
|
||||
f: &mut PyFormatter,
|
||||
) -> FormatResult<()> {
|
||||
debug_assert!(
|
||||
dangling_node_comments.is_empty(),
|
||||
"The node has dangling comments that need to be formatted manually. Add the special dangling comments handling to `fmt_fields` and override `fmt_dangling_comments` with an empty implementation that returns `Ok(())`."
|
||||
);
|
||||
|
||||
dangling_comments(dangling_node_comments).fmt(f)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue