diff --git a/resources/test/fixtures/flake8_simplify/SIM117.py b/resources/test/fixtures/flake8_simplify/SIM117.py index aa972ab0f8..97ac19c577 100644 --- a/resources/test/fixtures/flake8_simplify/SIM117.py +++ b/resources/test/fixtures/flake8_simplify/SIM117.py @@ -16,3 +16,15 @@ with A() as a: with B() as b: print("hello") a() + +async with A() as a: + with B() as b: + print("hello") + +with A() as a: + async with B() as b: + print("hello") + +async with A() as a: + async with B() as b: + print("hello") diff --git a/src/checkers/ast.rs b/src/checkers/ast.rs index ce6feaf9f8..769978fc0f 100644 --- a/src/checkers/ast.rs +++ b/src/checkers/ast.rs @@ -1279,7 +1279,7 @@ where } } } - StmtKind::With { items, body, .. } | StmtKind::AsyncWith { items, body, .. } => { + StmtKind::With { items, body, .. } => { if self.settings.enabled.contains(&RuleCode::B017) { flake8_bugbear::rules::assert_raises_exception(self, stmt, items); } @@ -1291,7 +1291,7 @@ where self, stmt, body, - self.current_stmt_parent().map(|parent| parent.0), + self.current_stmt_parent().map(Into::into), ); } }