Skip to content

Commit eb1f78d

Browse files
committed
fix infinite-loop in derive
1 parent 16cedb1 commit eb1f78d

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

derive/src/pymodule.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,13 @@ where
169169
while let Some((_, attr)) = iter.peek() {
170170
// take all cfgs but no py items
171171
let attr = *attr;
172-
let attr_name = if let Some(ident) = attr.get_ident() {
173-
ident.to_string()
174-
} else {
175-
continue;
176-
};
177-
if attr_name == "cfg" {
178-
cfgs.push(attr.clone());
179-
} else if ALL_ALLOWED_NAMES.contains(&attr_name.as_str()) {
180-
break;
172+
if let Some(ident) = attr.get_ident() {
173+
let attr_name = ident.to_string();
174+
if attr_name == "cfg" {
175+
cfgs.push(attr.clone());
176+
} else if ALL_ALLOWED_NAMES.contains(&attr_name.as_str()) {
177+
break;
178+
}
181179
}
182180
iter.next();
183181
}

0 commit comments

Comments
 (0)