]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_mir/src/borrow_check/diagnostics/outlives_suggestion.rs
use RegionNameHighlight for async fn and closure returns
[rust.git] / compiler / rustc_mir / src / borrow_check / diagnostics / outlives_suggestion.rs
index a775fa59c1b9dce220554c6197a3568f600462eb..7505e6e2dd11e224db3f97f0c0b91372335ac407 100644 (file)
@@ -115,9 +115,10 @@ fn compile_all_suggestions(
             //    should just replace 'a with 'static.
             // 3) Suggest unifying 'a with 'b if we have both 'a: 'b and 'b: 'a
 
-            if outlived.iter().any(|(_, outlived_name)| {
-                if let RegionNameSource::Static = outlived_name.source { true } else { false }
-            }) {
+            if outlived
+                .iter()
+                .any(|(_, outlived_name)| matches!(outlived_name.source, RegionNameSource::Static))
+            {
                 suggested.push(SuggestedConstraint::Static(fr_name));
             } else {
                 // We want to isolate out all lifetimes that should be unified and print out