mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-27 05:44:18 +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
|
@ -1,3 +1,4 @@
|
|||
use crate::comments::SourceComment;
|
||||
use ruff_formatter::{format_args, Format, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use ruff_python_ast::PatternMatchSequence;
|
||||
|
@ -55,6 +56,15 @@ impl FormatNodeRule<PatternMatchSequence> for FormatPatternMatchSequence {
|
|||
SequenceType::TupleNoParens => optional_parentheses(&items).fmt(f),
|
||||
}
|
||||
}
|
||||
|
||||
fn fmt_dangling_comments(
|
||||
&self,
|
||||
_dangling_node_comments: &[SourceComment],
|
||||
_f: &mut PyFormatter,
|
||||
) -> FormatResult<()> {
|
||||
// Handled as part of `fmt_fields`
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl NeedsParentheses for PatternMatchSequence {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue