Skip to content

Commit 3878d24

Browse files
committed
Remove redundant clone
1 parent 7b0735a commit 3878d24

File tree

35 files changed

+56
-65
lines changed

35 files changed

+56
-65
lines changed

src/bootstrap/dist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,8 +1447,8 @@ impl Step for Extended {
14471447
tarballs.extend(rls_installer.clone());
14481448
tarballs.extend(clippy_installer.clone());
14491449
tarballs.extend(rustfmt_installer.clone());
1450-
tarballs.extend(llvm_tools_installer.clone());
1451-
tarballs.extend(lldb_installer.clone());
1450+
tarballs.extend(llvm_tools_installer);
1451+
tarballs.extend(lldb_installer);
14521452
tarballs.push(analysis_installer);
14531453
tarballs.push(std_installer);
14541454
if builder.config.docs {

src/bootstrap/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ impl Step for Compiletest {
10521052
let hostflags = flags.clone();
10531053
cmd.arg("--host-rustcflags").arg(hostflags.join(" "));
10541054

1055-
let mut targetflags = flags.clone();
1055+
let mut targetflags = flags;
10561056
targetflags.push(format!(
10571057
"-Lnative={}",
10581058
builder.test_helpers_out(target).display()

src/librustc/infer/outlives/obligations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ where
458458
);
459459
debug!("projection_must_outlive: unique declared bound appears in trait ref");
460460
self.delegate
461-
.push_sub_region_constraint(origin.clone(), region, unique_bound);
461+
.push_sub_region_constraint(origin, region, unique_bound);
462462
return;
463463
}
464464

src/librustc/infer/region_constraints/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
749749
a // LUB(a,a) = a
750750
}
751751

752-
_ => self.combine_vars(tcx, Lub, a, b, origin.clone()),
752+
_ => self.combine_vars(tcx, Lub, a, b, origin),
753753
}
754754
}
755755

@@ -771,7 +771,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
771771
a // GLB(a,a) = a
772772
}
773773

774-
_ => self.combine_vars(tcx, Glb, a, b, origin.clone()),
774+
_ => self.combine_vars(tcx, Glb, a, b, origin),
775775
}
776776
}
777777

src/librustc/traits/error_reporting.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
239239

240240
let msg = format!("type mismatch resolving `{}`", predicate);
241241
let error_id = (DiagnosticMessageId::ErrorId(271),
242-
Some(obligation.cause.span), msg.clone());
242+
Some(obligation.cause.span), msg);
243243
let fresh = self.tcx.sess.one_time_diagnostics.borrow_mut().insert(error_id);
244244
if fresh {
245245
let mut diag = struct_span_err!(
@@ -379,7 +379,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
379379
}
380380
}
381381
if let Some(t) = self.get_parent_trait_ref(&obligation.cause.code) {
382-
flags.push(("parent_trait".to_owned(), Some(t.to_string())));
382+
flags.push(("parent_trait".to_owned(), Some(t)));
383383
}
384384

385385
if let Some(k) = obligation.cause.span.compiler_desugaring_kind() {

src/librustc/traits/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
594594

595595
// But for now, let's classify this as an overflow:
596596
let recursion_limit = *selcx.tcx().sess.recursion_limit.get();
597-
let obligation = Obligation::with_depth(cause.clone(),
597+
let obligation = Obligation::with_depth(cause,
598598
recursion_limit,
599599
param_env,
600600
projection_ty);

src/librustc/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12001200
cstore,
12011201
global_arenas: &arenas.global,
12021202
global_interners: interners,
1203-
dep_graph: dep_graph.clone(),
1203+
dep_graph,
12041204
types: common_types,
12051205
trait_map,
12061206
export_map: resolutions.export_map.into_iter().map(|(k, v)| {

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
695695
let mut err = self.cannot_act_on_moved_value(use_span,
696696
verb,
697697
msg,
698-
Some(nl.to_string()),
698+
Some(nl),
699699
Origin::Ast);
700700
let need_note = match lp.ty.sty {
701701
ty::Closure(id, _) => {

src/librustc_borrowck/borrowck/move_data.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl<'a, 'tcx> MoveData<'tcx> {
347347
lp = base_lp.clone();
348348
}
349349

350-
self.add_move_helper(tcx, orig_lp.clone(), id, kind);
350+
self.add_move_helper(tcx, orig_lp, id, kind);
351351
}
352352

353353
fn add_move_helper(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
@@ -359,7 +359,7 @@ impl<'a, 'tcx> MoveData<'tcx> {
359359
id,
360360
kind);
361361

362-
let path_index = self.move_path(tcx, lp.clone());
362+
let path_index = self.move_path(tcx, lp);
363363
let move_index = MoveIndex(self.moves.borrow().len());
364364

365365
let next_move = self.path_first_move(path_index);
@@ -402,7 +402,7 @@ impl<'a, 'tcx> MoveData<'tcx> {
402402
}
403403
}
404404

405-
self.add_assignment_helper(tcx, lp.clone(), assign_id, span);
405+
self.add_assignment_helper(tcx, lp, assign_id, span);
406406
}
407407

408408
fn add_assignment_helper(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,

src/librustc_codegen_llvm/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
784784
!tcx.sess.opts.output_types.should_codegen() {
785785
let ongoing_codegen = write::start_async_codegen(
786786
tcx,
787-
time_graph.clone(),
787+
time_graph,
788788
metadata,
789789
rx,
790790
1);

0 commit comments

Comments
 (0)