Skip to content

Commit db6c509

Browse files
committed
don't clone types that are copy (clippy::clone_on_copy)
1 parent 82fe5c1 commit db6c509

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

compiler/rustc_mir/src/transform/early_otherwise_branch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
217217

218218
// go through each target, finding a discriminant read, and a switch
219219
let results = discr.targets_with_values.iter().map(|(value, target)| {
220-
self.find_discriminant_switch_pairing(&discr, target.clone(), value.clone())
220+
self.find_discriminant_switch_pairing(&discr, *target, *value)
221221
});
222222

223223
// if the optimization did not apply for one of the targets, then abort

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
447447
);
448448
nested.push(Obligation::new(
449449
obligation.cause.clone(),
450-
obligation.param_env.clone(),
450+
obligation.param_env,
451451
normalized_super_trait,
452452
));
453453
}
@@ -485,7 +485,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
485485
);
486486
nested.push(Obligation::new(
487487
obligation.cause.clone(),
488-
obligation.param_env.clone(),
488+
obligation.param_env,
489489
normalized_bound,
490490
));
491491
}

compiler/rustc_typeck/src/check/upvar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
303303
// upvar_capture_map only stores the UpvarCapture (CaptureKind),
304304
// so we create a fake capture info with no expression.
305305
let fake_capture_info =
306-
ty::CaptureInfo { expr_id: None, capture_kind: capture_kind.clone() };
306+
ty::CaptureInfo { expr_id: None, capture_kind: *capture_kind };
307307
determine_capture_info(fake_capture_info, capture_info).capture_kind
308308
} else {
309309
capture_info.capture_kind

src/bootstrap/sanity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub fn check(build: &mut Build) {
162162
build
163163
.config
164164
.target_config
165-
.entry(target.clone())
165+
.entry(*target)
166166
.or_insert(Target::from_triple(&target.triple));
167167

168168
if target.contains("-none-") || target.contains("nvptx") {
@@ -176,7 +176,7 @@ pub fn check(build: &mut Build) {
176176
// If this is a native target (host is also musl) and no musl-root is given,
177177
// fall back to the system toolchain in /usr before giving up
178178
if build.musl_root(*target).is_none() && build.config.build == *target {
179-
let target = build.config.target_config.entry(target.clone()).or_default();
179+
let target = build.config.target_config.entry(*target).or_default();
180180
target.musl_root = Some("/usr".into());
181181
}
182182
match build.musl_libdir(*target) {

0 commit comments

Comments
 (0)