Use single lookup for leading, dangling, and trailing comments (#6589)

This commit is contained in:
Micha Reiser 2023-08-15 17:39:45 +02:00 committed by GitHub
parent 81b1176f99
commit 29c0b9f91c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 319 additions and 387 deletions

View file

@ -2,7 +2,7 @@ use ruff_formatter::{write, FormatRuleWithOptions};
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::{Constant, Expr, ExprAttribute, ExprConstant};
use crate::comments::{leading_comments, trailing_comments};
use crate::comments::{leading_comments, trailing_comments, SourceComment};
use crate::expression::parentheses::{
is_expression_parenthesized, NeedsParentheses, OptionalParentheses, Parentheses,
};
@ -150,7 +150,7 @@ impl FormatNodeRule<ExprAttribute> for FormatExprAttribute {
fn fmt_dangling_comments(
&self,
_node: &ExprAttribute,
_dangling_comments: &[SourceComment],
_f: &mut PyFormatter,
) -> FormatResult<()> {
// handle in `fmt_fields`