mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-16 23:35:52 +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
|
@ -91,7 +91,7 @@ impl FormatNodeRule<ExprBinOp> for FormatExprBinOp {
|
|||
)?;
|
||||
|
||||
// Format the operator on its own line if the right side has any leading comments.
|
||||
if comments.has_leading_comments(right.as_ref().into()) {
|
||||
if comments.has_leading_comments(right.as_ref()) {
|
||||
write!(f, [hard_line_break()])?;
|
||||
} else if needs_space {
|
||||
write!(f, [space()])?;
|
||||
|
|
|
@ -35,7 +35,7 @@ impl Format<PyFormatContext<'_>> for KeyValuePair<'_> {
|
|||
)
|
||||
} else {
|
||||
let comments = f.context().comments().clone();
|
||||
let leading_value_comments = comments.leading_comments(self.value.into());
|
||||
let leading_value_comments = comments.leading_comments(self.value);
|
||||
write!(
|
||||
f,
|
||||
[
|
||||
|
|
|
@ -19,7 +19,7 @@ impl FormatNodeRule<ExprList> for FormatExprList {
|
|||
} = item;
|
||||
|
||||
let comments = f.context().comments().clone();
|
||||
let dangling = comments.dangling_comments(item.into());
|
||||
let dangling = comments.dangling_comments(item);
|
||||
|
||||
// The empty list is special because there can be dangling comments, and they can be in two
|
||||
// positions:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue