Accept any Into<AnyNodeRef> as Comments arguments (#5205)

This commit is contained in:
Micha Reiser 2023-06-20 18:49:21 +02:00 committed by GitHub
parent 6f7d3cc798
commit b369288833
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 73 additions and 41 deletions

View file

@ -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,