Skip to content

Commit f7ddcd2

Browse files
authored
Break after annotation future found (RustPython#6284)
1 parent bab03bd commit f7ddcd2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

crates/codegen/src/symboltable.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -736,12 +736,10 @@ impl SymbolTableBuilder {
736736
if let Stmt::ImportFrom(StmtImportFrom { module, names, .. }) = &statement
737737
&& module.as_ref().map(|id| id.as_str()) == Some("__future__")
738738
{
739-
for feature in names {
740-
if &feature.name == "annotations" {
741-
self.future_annotations = true;
742-
}
743-
}
739+
self.future_annotations =
740+
self.future_annotations || names.iter().any(|future| &future.name == "annotations");
744741
}
742+
745743
match &statement {
746744
Stmt::Global(StmtGlobal { names, .. }) => {
747745
for name in names {

0 commit comments

Comments
 (0)