about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-07-18 14:21:59 +0900
committerGitHub <noreply@github.com>2021-07-18 14:21:59 +0900
commit810e47897aae7d19c7f0a58dc8ede07a4caae2a0 (patch)
tree6b576045cff186a74a459d06d486de47495dd6a8
parentc1ee9a3a03be7114044fd761110cc97f6cc845e7 (diff)
parent6ffb6c46c760cf93bbccb7ae4c7c9c1a6cc5d8df (diff)
downloadrust-810e47897aae7d19c7f0a58dc8ede07a4caae2a0.tar.gz
rust-810e47897aae7d19c7f0a58dc8ede07a4caae2a0.zip
Rollup merge of #87205 - matthiaskrgr:clippy_cln, r=oli-obk
rustc_middle: remove redundant clone

found while looking through some clippy lint warnings
-rw-r--r--compiler/rustc_middle/src/ty/closure.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/ty/closure.rs b/compiler/rustc_middle/src/ty/closure.rs
index b0156daf17e..6b51adc6aaf 100644
--- a/compiler/rustc_middle/src/ty/closure.rs
+++ b/compiler/rustc_middle/src/ty/closure.rs
@@ -281,11 +281,10 @@ pub struct CaptureInfo<'tcx> {
 }
 
 pub fn place_to_string_for_capture(tcx: TyCtxt<'tcx>, place: &HirPlace<'tcx>) -> String {
-    let name = match place.base {
+    let mut curr_string: String = match place.base {
         HirPlaceBase::Upvar(upvar_id) => tcx.hir().name(upvar_id.var_path.hir_id).to_string(),
         _ => bug!("Capture_information should only contain upvars"),
     };
-    let mut curr_string = name;
 
     for (i, proj) in place.projections.iter().enumerate() {
         match proj.kind {
@@ -314,7 +313,7 @@ pub fn place_to_string_for_capture(tcx: TyCtxt<'tcx>, place: &HirPlace<'tcx>) ->
         }
     }
 
-    curr_string.to_string()
+    curr_string
 }
 
 #[derive(Clone, PartialEq, Debug, TyEncodable, TyDecodable, TypeFoldable, Copy, HashStable)]