about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorLéo Lanteri Thauvin <leseulartichaut@gmail.com>2021-08-16 17:29:49 +0200
committerLéo Lanteri Thauvin <leseulartichaut@gmail.com>2021-08-25 20:24:35 +0200
commitfde1b76b4b1d0d84f5691f4785906b31bb91f38d (patch)
tree966691ff24d8ec26354d737e549bbfccaa658f3d /compiler/rustc_errors/src
parenta992a11913b39a258158646bb1e03528c5aa5060 (diff)
downloadrust-fde1b76b4b1d0d84f5691f4785906b31bb91f38d.tar.gz
rust-fde1b76b4b1d0d84f5691f4785906b31bb91f38d.zip
Use if-let guards in the codebase
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/lib.rs16
1 files changed, 9 insertions, 7 deletions
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::<Vec<_>>();
             if !error_codes.is_empty() {