Avoid C1901 violations within subscripts (#3517)

This commit is contained in:
Charlie Marsh 2023-03-16 22:52:05 -04:00 committed by GitHub
parent 73df267635
commit 373a77e8c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View file

@ -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)