Skip to content

Commit 509b947

Browse files
committedNov 10, 2022
Refactor nested for-loops into find() calls
1 parent fa99cb8 commit 509b947

File tree

1 file changed

+5
-12
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+5
-12
lines changed
 

‎compiler/rustc_ast_lowering/src/expr.rs

+5-12
Original file line numberDiff line numberDiff line change
@@ -617,18 +617,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
617617

618618
hir::ExprKind::Closure(c)
619619
};
620-
let mut parent_has_track_caller = false;
621-
for attrs in self.attrs.values() {
622-
for attr in attrs.into_iter() {
623-
if attr.has_name(sym::track_caller) {
624-
parent_has_track_caller = true;
625-
break;
626-
}
627-
}
628-
if parent_has_track_caller {
629-
break;
630-
}
631-
}
620+
let parent_has_track_caller = self
621+
.attrs
622+
.values()
623+
.find(|attrs| attrs.into_iter().find(|attr| attr.has_name(sym::track_caller)).is_some())
624+
.is_some();
632625
let unstable_span =
633626
self.mark_span_with_reason(DesugaringKind::Async, span, self.allow_gen_future.clone());
634627

0 commit comments

Comments
 (0)
Please sign in to comment.