diff options
| author | Josh Stone <jistone@redhat.com> | 2020-04-24 20:03:45 -0700 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2020-04-24 20:03:45 -0700 |
| commit | 4282776b1c394ed470d33f95c62538a2d37b16d3 (patch) | |
| tree | 56488a35e541b93dee40508b891a4bf0a916785d /src/librustc_errors | |
| parent | 3360cc3a0ea33c84d0b0b1163107b1c1acbf2a69 (diff) | |
| download | rust-4282776b1c394ed470d33f95c62538a2d37b16d3.tar.gz rust-4282776b1c394ed470d33f95c62538a2d37b16d3.zip | |
Replace filter_map().next() calls with find_map()
These are semantically the same, but `find_map()` is more concise.
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 0023ff595fc..b22da86c091 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -285,21 +285,18 @@ pub trait Emitter { let has_macro_spans = iter::once(&*span) .chain(children.iter().map(|child| &child.span)) .flat_map(|span| span.primary_spans()) - .copied() - .flat_map(|sp| { - sp.macro_backtrace().filter_map(|expn_data| { - match expn_data.kind { - ExpnKind::Root => None, + .flat_map(|sp| sp.macro_backtrace()) + .find_map(|expn_data| { + match expn_data.kind { + ExpnKind::Root => None, - // Skip past non-macro entries, just in case there - // are some which do actually involve macros. - ExpnKind::Desugaring(..) | ExpnKind::AstPass(..) => None, + // Skip past non-macro entries, just in case there + // are some which do actually involve macros. + ExpnKind::Desugaring(..) | ExpnKind::AstPass(..) => None, - ExpnKind::Macro(macro_kind, _) => Some(macro_kind), - } - }) - }) - .next(); + ExpnKind::Macro(macro_kind, _) => Some(macro_kind), + } + }); if !backtrace { self.fix_multispans_in_extern_macros(source_map, span, children); |
