From fde1b76b4b1d0d84f5691f4785906b31bb91f38d Mon Sep 17 00:00:00 2001 From: Léo Lanteri Thauvin Date: Mon, 16 Aug 2021 17:29:49 +0200 Subject: Use if-let guards in the codebase --- compiler/rustc_errors/src/lib.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'compiler/rustc_errors/src') diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index a48d4fe8bb5..02b6179f895 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -5,9 +5,11 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![feature(crate_visibility_modifier)] #![feature(backtrace)] +#![feature(if_let_guard)] #![feature(format_args_capture)] #![feature(iter_zip)] #![feature(nll)] +#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard #[macro_use] extern crate rustc_macros; @@ -1027,15 +1029,15 @@ impl HandlerInner { let mut error_codes = self .emitted_diagnostic_codes .iter() - .filter_map(|x| match &x { - DiagnosticId::Error(s) => { - if let Ok(Some(_explanation)) = registry.try_find_description(s) { - Some(s.clone()) - } else { - None - } + .filter_map(|x| { + match &x { + DiagnosticId::Error(s) + if let Ok(Some(_explanation)) = registry.try_find_description(s) => + { + Some(s.clone()) } _ => None, + } }) .collect::>(); if !error_codes.is_empty() { -- cgit 1.4.1-3-g733a5