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
This commit is contained in:
David Tolnay 2022-04-29 15:26:28 -07:00
parent 0389745203
commit 9125cc1c28
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
3 changed files with 2 additions and 3 deletions

View file

@ -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,

View file

@ -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.

View file

@ -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,
));
}