about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2023-01-14 06:29:16 +0000
committerMaybe Waffle <waffle.lapkin@gmail.com>2023-01-17 07:48:20 +0000
commit8d3c90ae13fa5dbad9e312a7c73b334ac2d8c1d7 (patch)
treeb596c347aab1de98a0a1248b3332aad6d2345bf2
parent98f30e833a2705fcb38d11b19ba75cd5fde723c7 (diff)
downloadrust-8d3c90ae13fa5dbad9e312a7c73b334ac2d8c1d7.tar.gz
rust-8d3c90ae13fa5dbad9e312a7c73b334ac2d8c1d7.zip
Review suggestions
-rw-r--r--compiler/rustc_const_eval/src/interpret/operand.rs6
-rw-r--r--compiler/rustc_hir_analysis/src/check/compare_impl_item.rs30
-rw-r--r--compiler/rustc_trait_selection/src/traits/query/normalize.rs2
3 files changed, 18 insertions, 20 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs
index 261f95da348..faf7e1fcb16 100644
--- a/compiler/rustc_const_eval/src/interpret/operand.rs
+++ b/compiler/rustc_const_eval/src/interpret/operand.rs
@@ -363,11 +363,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
         src: &OpTy<'tcx, M::Provenance>,
     ) -> InterpResult<'tcx, Either<MPlaceTy<'tcx, M::Provenance>, ImmTy<'tcx, M::Provenance>>> {
         Ok(match src.as_mplace_or_imm() {
-            Left(mplace) => {
-                if let Some(val) = self.read_immediate_from_mplace_raw(&mplace)? {
+            Left(ref mplace) => {
+                if let Some(val) = self.read_immediate_from_mplace_raw(mplace)? {
                     Right(val)
                 } else {
-                    Left(mplace)
+                    Left(*mplace)
                 }
             }
             Right(val) => Right(val),
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
index 5f1ee9641ee..3e0d33c64b3 100644
--- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
+++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
@@ -1368,22 +1368,20 @@ fn compare_number_of_method_arguments<'tcx>(
             })
             .or(trait_item_span);
 
-        let impl_span = {
-            let ImplItemKind::Fn(impl_m_sig, _) = &tcx.hir().expect_impl_item(impl_m.def_id.expect_local()).kind else { bug!("{:?} is not a method", impl_m) };
-            let pos = impl_number_args.saturating_sub(1);
-            impl_m_sig
-                .decl
-                .inputs
-                .get(pos)
-                .map(|arg| {
-                    if pos == 0 {
-                        arg.span
-                    } else {
-                        arg.span.with_lo(impl_m_sig.decl.inputs[0].span.lo())
-                    }
-                })
-                .unwrap_or(impl_m_span)
-        };
+        let ImplItemKind::Fn(impl_m_sig, _) = &tcx.hir().expect_impl_item(impl_m.def_id.expect_local()).kind else { bug!("{:?} is not a method", impl_m) };
+        let pos = impl_number_args.saturating_sub(1);
+        let impl_span = impl_m_sig
+            .decl
+            .inputs
+            .get(pos)
+            .map(|arg| {
+                if pos == 0 {
+                    arg.span
+                } else {
+                    arg.span.with_lo(impl_m_sig.decl.inputs[0].span.lo())
+                }
+            })
+            .unwrap_or(impl_m_span);
 
         let mut err = struct_span_err!(
             tcx.sess,
diff --git a/compiler/rustc_trait_selection/src/traits/query/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/normalize.rs
index 751aec48bd8..cea21c4f281 100644
--- a/compiler/rustc_trait_selection/src/traits/query/normalize.rs
+++ b/compiler/rustc_trait_selection/src/traits/query/normalize.rs
@@ -230,7 +230,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
                         if concrete_ty == ty {
                             bug!(
                                 "infinite recursion generic_ty: {:#?}, substs: {:#?}, \
-                             concrete_ty: {:#?}, ty: {:#?}",
+                                 concrete_ty: {:#?}, ty: {:#?}",
                                 generic_ty,
                                 substs,
                                 concrete_ty,