Skip to content

Commit

Permalink
Rollup merge of #87205 - matthiaskrgr:clippy_cln, r=oli-obk
Browse files Browse the repository at this point in the history
rustc_middle: remove redundant clone

found while looking through some clippy lint warnings
  • Loading branch information
JohnTitor committed Jul 18, 2021
2 parents c1ee9a3 + 6ffb6c4 commit 810e478
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/rustc_middle/src/ty/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)]
Expand Down

0 comments on commit 810e478

Please sign in to comment.