mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
Avoid C1901 violations within subscripts (#3517)
This commit is contained in:
parent
73df267635
commit
373a77e8c2
3 changed files with 17 additions and 0 deletions
|
@ -251,6 +251,11 @@ impl<'a> Context<'a> {
|
|||
self.exprs.iter().rev().nth(2)
|
||||
}
|
||||
|
||||
/// Return an [`Iterator`] over the current `Expr` parents.
|
||||
pub fn expr_ancestors(&self) -> impl Iterator<Item = &RefEquality<'a, Expr>> {
|
||||
self.exprs.iter().rev().skip(1)
|
||||
}
|
||||
|
||||
/// Return the `Stmt` that immediately follows the current `Stmt`, if any.
|
||||
pub fn current_sibling_stmt(&self) -> Option<&'a Stmt> {
|
||||
self.body.get(self.body_index + 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue