Attach dangling comments to the comprehension instead of the if or iter nodes (#7693)

This commit is contained in:
Micha Reiser 2023-09-29 11:45:01 +02:00 committed by GitHub
parent e62e245c61
commit e2ec42539b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 124 additions and 22 deletions

View file

@ -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)
}