From 2108be167dd3383f9765f0aa59dc69b35f8254b2 Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Mon, 15 Aug 2022 18:14:49 -0700 Subject: [PATCH] Remove unused `target.unwrap()`s. --- c2rust-analyze/src/borrowck/type_check.rs | 6 +----- c2rust-analyze/src/dataflow/type_check.rs | 6 +----- c2rust-analyze/src/expr_rewrite.rs | 4 +--- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/c2rust-analyze/src/borrowck/type_check.rs b/c2rust-analyze/src/borrowck/type_check.rs index 224132bbc2..a8e81361f9 100644 --- a/c2rust-analyze/src/borrowck/type_check.rs +++ b/c2rust-analyze/src/borrowck/type_check.rs @@ -210,7 +210,7 @@ impl<'tcx> TypeChecker<'tcx, '_> { ref func, ref args, destination, - target, + target: _, .. } => { let func_ty = func.ty(self.local_decls, *self.ltcx); @@ -218,10 +218,6 @@ impl<'tcx> TypeChecker<'tcx, '_> { match util::ty_callee(*self.ltcx, func_ty) { Some(Callee::PtrOffset { .. }) => { // We handle this like a pointer assignment. - - // `target` must be `Some` because the function doesn't diverge. - // TODO(kkysen) I kept the `.unwrap()` so that the behavior is identical. Do we need this? - target.unwrap(); let pl_lty = self.visit_place(destination); assert!(args.len() == 2); let rv_lty = self.visit_operand(&args[0]); diff --git a/c2rust-analyze/src/dataflow/type_check.rs b/c2rust-analyze/src/dataflow/type_check.rs index 13a42ed18b..10fed1af67 100644 --- a/c2rust-analyze/src/dataflow/type_check.rs +++ b/c2rust-analyze/src/dataflow/type_check.rs @@ -196,7 +196,7 @@ impl<'tcx> TypeChecker<'tcx, '_> { ref func, ref args, destination, - target, + target: _, .. } => { let func_ty = func.ty(self.mir, tcx); @@ -204,10 +204,6 @@ impl<'tcx> TypeChecker<'tcx, '_> { match util::ty_callee(tcx, func_ty) { Some(Callee::PtrOffset { .. }) => { // We handle this like a pointer assignment. - - // `target` must be `Some` because the function doesn't diverge. - // TODO(kkysen) I kept the `.unwrap()` so that the behavior is identical. Do we need this? - target.unwrap(); let ctx = PlaceContext::MutatingUse(MutatingUseContext::Store); let pl_lty = self.visit_place(destination, ctx); assert!(args.len() == 2); diff --git a/c2rust-analyze/src/expr_rewrite.rs b/c2rust-analyze/src/expr_rewrite.rs index d6f065e05a..37c9dcc42c 100644 --- a/c2rust-analyze/src/expr_rewrite.rs +++ b/c2rust-analyze/src/expr_rewrite.rs @@ -164,7 +164,7 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> { ref func, ref args, destination, - target, + target: _, .. } => { let func_ty = func.ty(self.mir, tcx); @@ -172,8 +172,6 @@ impl<'a, 'tcx> ExprRewriteVisitor<'a, 'tcx> { if let Some(callee) = util::ty_callee(tcx, func_ty) { // Special cases for particular functions. - // TODO(kkysen) I kept the `.unwrap()` so that the behavior is identical. Do we need this? - target.unwrap(); match callee { Callee::PtrOffset { .. } => { self.visit_ptr_offset(&args[0], pl_ty);