Skip to content

Commit

Permalink
Refactor nested for-loops into find() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
bryangarza committed Nov 10, 2022
1 parent fa99cb8 commit 509b947
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,18 +617,11 @@ impl<'hir> LoweringContext<'_, 'hir> {

hir::ExprKind::Closure(c)
};
let mut parent_has_track_caller = false;
for attrs in self.attrs.values() {
for attr in attrs.into_iter() {
if attr.has_name(sym::track_caller) {
parent_has_track_caller = true;
break;
}
}
if parent_has_track_caller {
break;
}
}
let parent_has_track_caller = self
.attrs
.values()
.find(|attrs| attrs.into_iter().find(|attr| attr.has_name(sym::track_caller)).is_some())
.is_some();
let unstable_span =
self.mark_span_with_reason(DesugaringKind::Async, span, self.allow_gen_future.clone());

Expand Down

0 comments on commit 509b947

Please sign in to comment.