mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
Accept any Into<AnyNodeRef>
as Comments
arguments (#5205)
This commit is contained in:
parent
6f7d3cc798
commit
b369288833
9 changed files with 73 additions and 41 deletions
|
@ -23,7 +23,7 @@ impl FormatNodeRule<StmtIf> for FormatStmtIf {
|
|||
} = current_statement;
|
||||
|
||||
let first_statement = body.first().ok_or(FormatError::SyntaxError)?;
|
||||
let trailing = comments.dangling_comments(current_statement.into());
|
||||
let trailing = comments.dangling_comments(current_statement);
|
||||
|
||||
let trailing_if_comments_end = trailing
|
||||
.partition_point(|comment| comment.slice().start() < first_statement.start());
|
||||
|
@ -32,7 +32,7 @@ impl FormatNodeRule<StmtIf> for FormatStmtIf {
|
|||
trailing.split_at(trailing_if_comments_end);
|
||||
|
||||
if current.is_elif() {
|
||||
let elif_leading = comments.leading_comments(current_statement.into());
|
||||
let elif_leading = comments.leading_comments(current_statement);
|
||||
// Manually format the leading comments because the formatting bypasses `NodeRule::fmt`
|
||||
write!(
|
||||
f,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue