mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 20:42:10 +00:00
Rename Comments methods (#6649)
This commit is contained in:
parent
3ceb6fbeb0
commit
0cea4975fc
44 changed files with 128 additions and 172 deletions
|
@ -45,7 +45,7 @@ impl FormatNodeRule<ExprAttribute> for FormatExprAttribute {
|
|||
);
|
||||
|
||||
let comments = f.context().comments().clone();
|
||||
let dangling_comments = comments.dangling_comments(item);
|
||||
let dangling_comments = comments.dangling(item);
|
||||
let leading_attribute_comments_start = dangling_comments
|
||||
.partition_point(|comment| comment.line_position().is_end_of_line());
|
||||
let (trailing_dot_comments, leading_attribute_comments) =
|
||||
|
@ -88,7 +88,7 @@ impl FormatNodeRule<ExprAttribute> for FormatExprAttribute {
|
|||
value.format().fmt(f)?;
|
||||
}
|
||||
|
||||
if comments.has_trailing_own_line_comments(value.as_ref()) {
|
||||
if comments.has_trailing_own_line(value.as_ref()) {
|
||||
hard_line_break().fmt(f)?;
|
||||
}
|
||||
|
||||
|
@ -171,10 +171,10 @@ impl NeedsParentheses for ExprAttribute {
|
|||
OptionalParentheses::Multiline
|
||||
} else if context
|
||||
.comments()
|
||||
.dangling_comments(self)
|
||||
.dangling(self)
|
||||
.iter()
|
||||
.any(|comment| comment.line_position().is_own_line())
|
||||
|| context.comments().has_trailing_own_line_comments(self)
|
||||
|| context.comments().has_trailing_own_line(self)
|
||||
{
|
||||
OptionalParentheses::Always
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue