about summary refs log tree commit diff
path: root/compiler/rustc_monomorphize/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-02-20 00:37:34 +0100
committerGitHub <noreply@github.com>2022-02-20 00:37:34 +0100
commitf2d6770f779051f1f5a28451b68784d2103bca32 (patch)
tree90ba27b14c38a8ff603d9aef8642a16b58a7f52d /compiler/rustc_monomorphize/src
parent7ca1c48bbb6d300bda665a59b7ad226bc71e7be9 (diff)
parent2ef8af66196f7cc270a0532ea989f2fc6bc6885d (diff)
Rollup merge of #94146 - est31:let_else, r=cjgillot
Adopt let else in more places

Continuation of #89933, #91018, #91481, #93046, #93590, #94011.

I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This is the biggest of these PRs and handles the changes outside of rustdoc, rustc_typeck, rustc_const_eval, rustc_trait_selection, which were handled in PRs #94139, #94142, #94143, #94144.
Diffstat (limited to 'compiler/rustc_monomorphize/src')
-rw-r--r--compiler/rustc_monomorphize/src/collector.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs
index 72c1b3fa6e9..bd42505e3a3 100644
--- a/compiler/rustc_monomorphize/src/collector.rs
+++ b/compiler/rustc_monomorphize/src/collector.rs
@@ -847,14 +847,13 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
                 debug!(?source_info);
                 let lint_root = source_info.scope.lint_root(&self.body.source_scopes);
                 debug!(?lint_root);
-                let lint_root = match lint_root {
-                    Some(lint_root) => lint_root,
+                let Some(lint_root) = lint_root else {
                     // This happens when the issue is in a function from a foreign crate that
                     // we monomorphized in the current crate. We can't get a `HirId` for things
                     // in other crates.
                     // FIXME: Find out where to report the lint on. Maybe simply crate-level lint root
                     // but correct span? This would make the lint at least accept crate-level lint attributes.
-                    None => return,
+                    return;
                 };
                 self.tcx.struct_span_lint_hir(
                     LARGE_ASSIGNMENTS,
@@ -1256,9 +1255,8 @@ impl<'v> RootCollector<'_, 'v> {
     /// the return type of `main`. This is not needed when
     /// the user writes their own `start` manually.
     fn push_extra_entry_roots(&mut self) {
-        let main_def_id = match self.entry_fn {
-            Some((def_id, EntryFnType::Main)) => def_id,
-            _ => return,
+        let Some((main_def_id, EntryFnType::Main)) = self.entry_fn else {
+            return;
         };
 
         let start_def_id = match self.tcx.lang_items().require(LangItem::Start) {