Skip to content

Commit 9125cc1

Browse files
committed
Resolve clippy::clone_on_copy
error: using `clone` on type `std::option::Option<u128>` which implements the `Copy` trait --> src/shims/tls.rs:307:24 | 307 | let last_key = this.machine.tls.dtors_running[&active_thread].last_dtor_key.clone(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `this.machine.tls.dtors_running[&active_thread].last_dtor_key` | = note: `-D clippy::clone-on-copy` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy error: using `clone` on type `stacked_borrows::Item` which implements the `Copy` trait --> src/stacked_borrows.rs:317:21 | 317 | item.clone(), | ^^^^^^^^^^^^ help: try dereferencing it: `*item` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
1 parent 0389745 commit 9125cc1

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#![allow(clippy::cast_lossless)]
1111
// TODO: Uncategorized. Some of these we'll want to fix, some keep ignored.
1212
#![allow(
13-
clippy::clone_on_copy,
1413
clippy::collapsible_else_if,
1514
clippy::collapsible_if,
1615
clippy::comparison_chain,

src/shims/tls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
304304

305305
assert!(this.has_terminated(active_thread), "running TLS dtors for non-terminated thread");
306306
// Fetch next dtor after `key`.
307-
let last_key = this.machine.tls.dtors_running[&active_thread].last_dtor_key.clone();
307+
let last_key = this.machine.tls.dtors_running[&active_thread].last_dtor_key;
308308
let dtor = match this.machine.tls.fetch_tls_dtor(last_key, active_thread) {
309309
dtor @ Some(_) => dtor,
310310
// We ran each dtor once, start over from the beginning.

src/stacked_borrows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ impl<'tcx> Stack {
314314
if let SbTag::Tagged(id) = item.tag {
315315
if global.tracked_pointer_tags.contains(&id) {
316316
register_diagnostic(NonHaltingDiagnostic::PoppedPointerTag(
317-
item.clone(),
317+
*item,
318318
provoking_access,
319319
));
320320
}

0 commit comments

Comments
 (0)