Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6153ea8

Browse files
committed
loop-that-never-loops
1 parent 368e0bb commit 6153ea8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

crates/hir-def/src/attr.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,17 @@ impl Attrs {
251251
let enum_ = &item_tree[loc.id.value];
252252

253253
let cfg_options = &crate_graph[krate].cfg_options;
254-
let variant = 'tri: loop {
255-
let mut idx = 0;
256-
for variant in enum_.variants.clone() {
257-
let attrs = item_tree.attrs(db, krate, variant.into());
258-
if attrs.is_cfg_enabled(cfg_options) {
259-
if it.local_id == Idx::from_raw(RawIdx::from(idx)) {
260-
break 'tri variant;
261-
}
262-
idx += 1;
254+
let mut idx = 0;
255+
let Some(variant) = enum_.variants.clone().find(|variant| {
256+
let attrs = item_tree.attrs(db, krate, (*variant).into());
257+
if attrs.is_cfg_enabled(cfg_options) {
258+
if it.local_id == Idx::from_raw(RawIdx::from(idx)) {
259+
return true
263260
}
261+
idx += 1;
264262
}
263+
false
264+
}) else {
265265
return Arc::new(res);
266266
};
267267
(item_tree[variant].fields.clone(), item_tree, krate)

0 commit comments

Comments
 (0)