Avoid searching for bracketed comments in unparenthesized generators (#7627)
Similar to tuples, a generator _can_ be parenthesized or unparenthesized. Only search for bracketed comments if it contains its own parentheses. Closes https://github.com/astral-sh/ruff/issues/7623.
This commit is contained in:
@@ -221,7 +221,7 @@ impl NeedsParentheses for ExprTuple {
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if a tuple has already had parentheses in the input
|
||||
/// Return `true` if a tuple is parenthesized in the source code.
|
||||
pub(crate) fn is_tuple_parenthesized(tuple: &ExprTuple, source: &str) -> bool {
|
||||
let Some(elt) = tuple.elts.first() else {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user