mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 12:29:28 +00:00
Move is_tuple_parenthesized
from the formatter to ruff_python_ast
(#9533)
This allows it to be used in the linter as well as the formatter. It will be useful in #9474
This commit is contained in:
parent
64aac5d526
commit
a1e65a92bd
4 changed files with 38 additions and 40 deletions
|
@ -14,7 +14,6 @@ use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
|
|||
use crate::comments::visitor::{CommentPlacement, DecoratedComment};
|
||||
use crate::expression::expr_generator_exp::is_generator_parenthesized;
|
||||
use crate::expression::expr_slice::{assign_comment_in_slice, ExprSliceCommentSection};
|
||||
use crate::expression::expr_tuple::is_tuple_parenthesized;
|
||||
use crate::other::parameters::{
|
||||
assign_argument_separator_comment_placement, find_parameter_separators,
|
||||
};
|
||||
|
@ -294,7 +293,7 @@ fn handle_enclosed_comment<'a>(
|
|||
| AnyNodeRef::ExprSet(_)
|
||||
| AnyNodeRef::ExprListComp(_)
|
||||
| AnyNodeRef::ExprSetComp(_) => handle_bracketed_end_of_line_comment(comment, locator),
|
||||
AnyNodeRef::ExprTuple(tuple) if is_tuple_parenthesized(tuple, locator.contents()) => {
|
||||
AnyNodeRef::ExprTuple(tuple) if tuple.is_parenthesized(locator.contents()) => {
|
||||
handle_bracketed_end_of_line_comment(comment, locator)
|
||||
}
|
||||
AnyNodeRef::ExprGeneratorExp(generator)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue