about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2023-08-26 13:37:43 -0300
committerSantiago Pastorino <spastorino@gmail.com>2023-08-26 13:37:43 -0300
commitb92840accfd8f4816274cfa2862da739fff740dd (patch)
treeaadb87d9250e462bda979d114ceba4186ba92d33
parente2efb6ab29b58edf84ebeec1160f14bd160ae895 (diff)
downloadrust-b92840accfd8f4816274cfa2862da739fff740dd.tar.gz
rust-b92840accfd8f4816274cfa2862da739fff740dd.zip
Merge if and match expressions that don't make sense to have separated
-rw-r--r--compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs25
1 files changed, 10 insertions, 15 deletions
diff --git a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
index de8cc31be79..cb651363982 100644
--- a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
+++ b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
@@ -214,7 +214,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
                                 true
                             }
                             VarValue::Value(cur_region) => {
-                                let lub = match *cur_region {
+                                match *cur_region {
                                     // If this empty region is from a universe that can name the
                                     // placeholder universe, then the LUB is the Placeholder region
                                     // (which is the cur_region). Otherwise, the LUB is the Static
@@ -222,22 +222,17 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
                                     RePlaceholder(placeholder)
                                         if !a_universe.can_name(placeholder.universe) =>
                                     {
-                                        self.tcx().lifetimes.re_static
+                                        let lub = self.tcx().lifetimes.re_static;
+                                        debug!(
+                                            "Expanding value of {:?} from {:?} to {:?}",
+                                            b_vid, cur_region, lub
+                                        );
+
+                                        *b_data = VarValue::Value(lub);
+                                        true
                                     }
 
-                                    _ => cur_region,
-                                };
-
-                                if lub == cur_region {
-                                    false
-                                } else {
-                                    debug!(
-                                        "Expanding value of {:?} from {:?} to {:?}",
-                                        b_vid, cur_region, lub
-                                    );
-
-                                    *b_data = VarValue::Value(lub);
-                                    true
+                                    _ => false,
                                 }
                             }