mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 04:19:18 +00:00
Rename Comments methods (#6649)
This commit is contained in:
parent
3ceb6fbeb0
commit
0cea4975fc
44 changed files with 128 additions and 172 deletions
|
@ -33,7 +33,7 @@ impl FormatNodeRule<StmtWith> for FormatStmtWith {
|
|||
// ...
|
||||
// ```
|
||||
let comments = f.context().comments().clone();
|
||||
let dangling_comments = comments.dangling_comments(item.as_any_node_ref());
|
||||
let dangling_comments = comments.dangling(item.as_any_node_ref());
|
||||
let partition_point = dangling_comments.partition_point(|comment| {
|
||||
item.items
|
||||
.first()
|
||||
|
@ -86,9 +86,7 @@ impl FormatNodeRule<StmtWith> for FormatStmtWith {
|
|||
} else if let [item] = item.items.as_slice() {
|
||||
// This is similar to `maybe_parenthesize_expression`, but we're not dealing with an
|
||||
// expression here, it's a `WithItem`.
|
||||
if comments.has_leading_comments(item)
|
||||
|| comments.has_trailing_own_line_comments(item)
|
||||
{
|
||||
if comments.has_leading(item) || comments.has_trailing_own_line(item) {
|
||||
optional_parentheses(&item.format()).fmt(f)?;
|
||||
} else {
|
||||
item.format().fmt(f)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue