From 9125cc1c280ca9c13ae341a4cf12eee30c52f76d Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 29 Apr 2022 15:26:28 -0700 Subject: [PATCH] Resolve clippy::clone_on_copy error: using `clone` on type `std::option::Option` 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 --- src/lib.rs | 1 - src/shims/tls.rs | 2 +- src/stacked_borrows.rs | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8dca869aa84b..083dff0e61e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,6 @@ #![allow(clippy::cast_lossless)] // TODO: Uncategorized. Some of these we'll want to fix, some keep ignored. #![allow( - clippy::clone_on_copy, clippy::collapsible_else_if, clippy::collapsible_if, clippy::comparison_chain, diff --git a/src/shims/tls.rs b/src/shims/tls.rs index ceed123c7ac4..31a3e12b41bd 100644 --- a/src/shims/tls.rs +++ b/src/shims/tls.rs @@ -304,7 +304,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx assert!(this.has_terminated(active_thread), "running TLS dtors for non-terminated thread"); // Fetch next dtor after `key`. - let last_key = this.machine.tls.dtors_running[&active_thread].last_dtor_key.clone(); + let last_key = this.machine.tls.dtors_running[&active_thread].last_dtor_key; let dtor = match this.machine.tls.fetch_tls_dtor(last_key, active_thread) { dtor @ Some(_) => dtor, // We ran each dtor once, start over from the beginning. diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index 9d175e9c4d16..d6caba81713c 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -314,7 +314,7 @@ impl<'tcx> Stack { if let SbTag::Tagged(id) = item.tag { if global.tracked_pointer_tags.contains(&id) { register_diagnostic(NonHaltingDiagnostic::PoppedPointerTag( - item.clone(), + *item, provoking_access, )); }