Skip to content

Commit 543715d

Browse files
Rollup merge of #87205 - matthiaskrgr:clippy_cln, r=oli-obk
rustc_middle: remove redundant clone found while looking through some clippy lint warnings
2 parents ed4b003 + 6ffb6c4 commit 543715d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

compiler/rustc_middle/src/ty/closure.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,10 @@ pub struct CaptureInfo<'tcx> {
281281
}
282282

283283
pub fn place_to_string_for_capture(tcx: TyCtxt<'tcx>, place: &HirPlace<'tcx>) -> String {
284-
let name = match place.base {
284+
let mut curr_string: String = match place.base {
285285
HirPlaceBase::Upvar(upvar_id) => tcx.hir().name(upvar_id.var_path.hir_id).to_string(),
286286
_ => bug!("Capture_information should only contain upvars"),
287287
};
288-
let mut curr_string = name;
289288

290289
for (i, proj) in place.projections.iter().enumerate() {
291290
match proj.kind {
@@ -314,7 +313,7 @@ pub fn place_to_string_for_capture(tcx: TyCtxt<'tcx>, place: &HirPlace<'tcx>) ->
314313
}
315314
}
316315

317-
curr_string.to_string()
316+
curr_string
318317
}
319318

320319
#[derive(Clone, PartialEq, Debug, TyEncodable, TyDecodable, TypeFoldable, Copy, HashStable)]

0 commit comments

Comments
 (0)