about summary refs log tree commit diff
path: root/compiler/rustc_infer/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-16 13:12:53 +0000
committerbors <bors@rust-lang.org>2023-04-16 13:12:53 +0000
commit8a778ca1e35e4a8df95c00d800100d95e63e7722 (patch)
treef74a5282fe636aa9e51d238b2cb46a9092a5c38b /compiler/rustc_infer/src
parent1b50ea9abb65b33aac7285dbe36b37f9e33381a2 (diff)
parent38215fb77aca2dcd25277ff7b3093ea56e4e8ffb (diff)
downloadrust-8a778ca1e35e4a8df95c00d800100d95e63e7722.tar.gz
rust-8a778ca1e35e4a8df95c00d800100d95e63e7722.zip
Auto merge of #110405 - fee1-dead-contrib:rollup-9rkree6, r=fee1-dead
Rollup of 4 pull requests

Successful merges:

 - #110397 (Move some utils out of `rustc_const_eval`)
 - #110398 (use matches! macro in more places)
 - #110400 (more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_defau…)
 - #110402 (Remove the loop in `Align::from_bytes`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_infer/src')
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs11
-rw-r--r--compiler/rustc_infer/src/infer/mod.rs8
-rw-r--r--compiler/rustc_infer/src/traits/mod.rs8
3 files changed, 12 insertions, 15 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs
index 22c1e387117..27c3b796d14 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs
@@ -312,13 +312,10 @@ pub fn suggest_new_region_bound(
                             Applicability::MaybeIncorrect,
                         );
                     }
-                } else if opaque.bounds.iter().any(|arg| match arg {
-                    GenericBound::Outlives(Lifetime { ident, .. })
-                        if ident.name.to_string() == lifetime_name =>
-                    {
-                        true
-                    }
-                    _ => false,
+                } else if opaque.bounds.iter().any(|arg| {
+                    matches!(arg,
+                        GenericBound::Outlives(Lifetime { ident, .. })
+                        if ident.name.to_string() == lifetime_name )
                 }) {
                 } else {
                     // get a lifetime name of existing named lifetimes if any
diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs
index 66f51328bbe..f263a0773e4 100644
--- a/compiler/rustc_infer/src/infer/mod.rs
+++ b/compiler/rustc_infer/src/infer/mod.rs
@@ -1577,10 +1577,10 @@ impl<'tcx> InferCtxt<'tcx> {
             (TyOrConstInferVar::Ty(ty_var), Ok(inner)) => {
                 use self::type_variable::TypeVariableValue;
 
-                match inner.try_type_variables_probe_ref(ty_var) {
-                    Some(TypeVariableValue::Unknown { .. }) => true,
-                    _ => false,
-                }
+                matches!(
+                    inner.try_type_variables_probe_ref(ty_var),
+                    Some(TypeVariableValue::Unknown { .. })
+                )
             }
             _ => false,
         };
diff --git a/compiler/rustc_infer/src/traits/mod.rs b/compiler/rustc_infer/src/traits/mod.rs
index e01b6caf430..9dd4f0a8e4c 100644
--- a/compiler/rustc_infer/src/traits/mod.rs
+++ b/compiler/rustc_infer/src/traits/mod.rs
@@ -89,10 +89,10 @@ impl<'tcx> PredicateObligation<'tcx> {
 impl<'tcx> TraitObligation<'tcx> {
     /// Returns `true` if the trait predicate is considered `const` in its ParamEnv.
     pub fn is_const(&self) -> bool {
-        match (self.predicate.skip_binder().constness, self.param_env.constness()) {
-            (ty::BoundConstness::ConstIfConst, hir::Constness::Const) => true,
-            _ => false,
-        }
+        matches!(
+            (self.predicate.skip_binder().constness, self.param_env.constness()),
+            (ty::BoundConstness::ConstIfConst, hir::Constness::Const)
+        )
     }
 
     pub fn derived_cause(