about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-02-13 16:36:47 +0900
committerGitHub <noreply@github.com>2021-02-13 16:36:47 +0900
commitf6677b0f52e2e4bb557945652f03cd1b4bf55c4a (patch)
treeab4aa5de4fed8b0b6697f6612ba2bad24d33f42d
parent14b217c43e5ad90d881af2957be4fcb0049902a0 (diff)
parent28347ebdb3946b4298629bbaca72318ef890e04b (diff)
downloadrust-f6677b0f52e2e4bb557945652f03cd1b4bf55c4a.tar.gz
rust-f6677b0f52e2e4bb557945652f03cd1b4bf55c4a.zip
Rollup merge of #82031 - LingMan:unneeded_var, r=varkor
Drop an unnecessary intermediate variable

Neither does it shorten the code nor does it provide a helpful name.

`@rustbot` modify labels +C-cleanup +T-compiler

r? `@varkor`
-rw-r--r--compiler/rustc_typeck/src/check/upvar.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs
index 75cad9f21c9..c666cd774c4 100644
--- a/compiler/rustc_typeck/src/check/upvar.rs
+++ b/compiler/rustc_typeck/src/check/upvar.rs
@@ -260,8 +260,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         // local crate or were inlined into it along with some function.
         // This may change if abstract return types of some sort are
         // implemented.
-        let tcx = self.tcx;
-
         self.typeck_results
             .borrow()
             .closure_min_captures_flattened(closure_id)
@@ -276,7 +274,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
                 match capture {
                     ty::UpvarCapture::ByValue(_) => upvar_ty,
-                    ty::UpvarCapture::ByRef(borrow) => tcx.mk_ref(
+                    ty::UpvarCapture::ByRef(borrow) => self.tcx.mk_ref(
                         borrow.region,
                         ty::TypeAndMut { ty: upvar_ty, mutbl: borrow.kind.to_mutbl_lossy() },
                     ),