diff options
| author | Bryan Garza <1396101+bryangarza@users.noreply.github.com> | 2022-11-10 00:13:48 +0000 |
|---|---|---|
| committer | Bryan Garza <1396101+bryangarza@users.noreply.github.com> | 2022-11-10 00:13:48 +0000 |
| commit | 509b9478f58582d8ddca1e2a31436e487b74fae5 (patch) | |
| tree | a8ae1baf2c082378222b2ca85c33c2694c3042fd | |
| parent | fa99cb82690d99c0df2018d37aedaed29e40e131 (diff) | |
| download | rust-509b9478f58582d8ddca1e2a31436e487b74fae5.tar.gz rust-509b9478f58582d8ddca1e2a31436e487b74fae5.zip | |
Refactor nested for-loops into find() calls
| -rw-r--r-- | compiler/rustc_ast_lowering/src/expr.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 6f68f679cc0..12930fd1363 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -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()); |
