[ruff] fix async comprehension false positive (RUF029) (#11070)

## Summary

- Fix #11043 

## Test Plan

Added the false positive code in the test fixture.
This commit is contained in:
Jonathan Plasse 2024-04-21 14:17:25 +02:00 committed by GitHub
parent d544199272
commit a68938897d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -84,6 +84,11 @@ impl<'a> preorder::PreorderVisitor<'a> for AsyncExprVisitor {
_ => preorder::walk_stmt(self, stmt),
}
}
fn visit_comprehension(&mut self, comprehension: &'a ast::Comprehension) {
if comprehension.is_async {
self.found_await_or_async = true;
}
}
}
/// Very nearly `crate::node::StmtFunctionDef.visit_preorder`, except it is specialized and,