diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-02-15 11:43:41 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-02-16 15:26:00 +0000 |
| commit | 8751fa1a9abda9fc7ced6b03315efbd82310830d (patch) | |
| tree | f15613d5ca2fa5aadfdde2df1d94907d1798a5bb /compiler/rustc_resolve/src | |
| parent | af3c8b27266e290cf65704284f6862d0f90ee4fc (diff) | |
| download | rust-8751fa1a9abda9fc7ced6b03315efbd82310830d.tar.gz rust-8751fa1a9abda9fc7ced6b03315efbd82310830d.zip | |
`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/late/diagnostics.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index a3195a64366..5205d055cf9 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1700,11 +1700,9 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { let crate_mod = Res::Def(DefKind::Mod, crate_id.as_def_id()); - if filter_fn(crate_mod) { - Some(TypoSuggestion::typo_from_ident(*ident, crate_mod)) - } else { - None - } + filter_fn(crate_mod).then(|| { + TypoSuggestion::typo_from_ident(*ident, crate_mod) + }) }) })); |
