about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-10-12 12:59:32 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2024-10-23 22:22:56 +0200
commit464f4057c28ef3c6ae4acb696ee27f7f3f2112ce (patch)
treeade4449cfa3f618c00408c38b5488e6b7df3c81f
parentdab76eccdfbb6f7b4b445ad05ba4ef004c43e130 (diff)
downloadrust-464f4057c28ef3c6ae4acb696ee27f7f3f2112ce.tar.gz
rust-464f4057c28ef3c6ae4acb696ee27f7f3f2112ce.zip
fix some manual_map
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs10
-rw-r--r--compiler/rustc_hir_typeck/src/method/suggest.rs2
2 files changed, 4 insertions, 8 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
index a5f3298b02c..315851729b1 100644
--- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
@@ -959,13 +959,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
                         None
                     }
                 }
-                hir::ExprKind::MethodCall(_, _, args, span) => {
-                    if let Some(def_id) = typeck_results.type_dependent_def_id(*hir_id) {
-                        Some((def_id, *span, *args))
-                    } else {
-                        None
-                    }
-                }
+                hir::ExprKind::MethodCall(_, _, args, span) => typeck_results
+                    .type_dependent_def_id(*hir_id)
+                    .map(|def_id| (def_id, *span, *args)),
                 _ => None,
             }
         };
diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs
index 9dd59541148..eaf40a193a6 100644
--- a/compiler/rustc_hir_typeck/src/method/suggest.rs
+++ b/compiler/rustc_hir_typeck/src/method/suggest.rs
@@ -537,7 +537,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     && binding_id != self.binding_id
                 {
                     if self.check_and_add_sugg_binding(LetStmt {
-                        ty_hir_id_opt: if let Some(ty) = ty { Some(ty.hir_id) } else { None },
+                        ty_hir_id_opt: ty.map(|ty| ty.hir_id),
                         binding_id,
                         span: pat.span,
                         init_hir_id: init.hir_id,