From 1c9af435a54d899ac7f11b3525972a63bfdc5038 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Thu, 25 May 2023 16:33:42 -0400 Subject: [PATCH] Don't `allow(dropping_copy_types)` --- crossbeam-channel/tests/mpsc.rs | 6 +----- crossbeam-channel/tests/ready.rs | 2 -- crossbeam-channel/tests/select.rs | 2 -- crossbeam-channel/tests/select_macro.rs | 18 +++++++++--------- crossbeam-epoch/src/deferred.rs | 7 +++---- 5 files changed, 13 insertions(+), 22 deletions(-) diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs index 6a297c5b8..0cea23393 100644 --- a/crossbeam-channel/tests/mpsc.rs +++ b/crossbeam-channel/tests/mpsc.rs @@ -20,11 +20,7 @@ //! - https://github.com/rust-lang/rust/blob/master/COPYRIGHT //! - https://www.rust-lang.org/en-US/legal.html -#![allow( - dropping_copy_types, - clippy::match_single_binding, - clippy::redundant_clone -)] +#![allow(clippy::match_single_binding, clippy::redundant_clone)] use std::sync::mpsc::{RecvError, RecvTimeoutError, TryRecvError}; use std::sync::mpsc::{SendError, TrySendError}; diff --git a/crossbeam-channel/tests/ready.rs b/crossbeam-channel/tests/ready.rs index bb2b9ce62..ca84f869c 100644 --- a/crossbeam-channel/tests/ready.rs +++ b/crossbeam-channel/tests/ready.rs @@ -1,7 +1,5 @@ //! Tests for channel readiness using the `Select` struct. -#![allow(dropping_copy_types)] - use std::any::Any; use std::cell::Cell; use std::thread; diff --git a/crossbeam-channel/tests/select.rs b/crossbeam-channel/tests/select.rs index ae136d25b..38178404d 100644 --- a/crossbeam-channel/tests/select.rs +++ b/crossbeam-channel/tests/select.rs @@ -1,7 +1,5 @@ //! Tests for channel selection using the `Select` struct. -#![allow(dropping_copy_types)] - use std::any::Any; use std::cell::Cell; use std::thread; diff --git a/crossbeam-channel/tests/select_macro.rs b/crossbeam-channel/tests/select_macro.rs index e00c7929d..c48080975 100644 --- a/crossbeam-channel/tests/select_macro.rs +++ b/crossbeam-channel/tests/select_macro.rs @@ -1,7 +1,7 @@ //! Tests for the `select!` macro. #![forbid(unsafe_code)] // select! is safe. -#![allow(dropping_copy_types, clippy::match_single_binding)] +#![allow(clippy::match_single_binding)] use std::any::Any; use std::cell::Cell; @@ -1212,32 +1212,32 @@ fn result_types() { let (_, r) = bounded::(0); select! { - recv(r) -> res => drop::>(res), + recv(r) -> res => { let _: Result = res; }, } select! { - recv(r) -> res => drop::>(res), + recv(r) -> res => { let _: Result = res; }, default => {} } select! { - recv(r) -> res => drop::>(res), + recv(r) -> res => { let _: Result = res; }, default(ms(0)) => {} } select! { - send(s, 0) -> res => drop::>>(res), + send(s, 0) -> res => { let _: Result<(), SendError> = res; }, } select! { - send(s, 0) -> res => drop::>>(res), + send(s, 0) -> res => { let _: Result<(), SendError> = res; }, default => {} } select! { - send(s, 0) -> res => drop::>>(res), + send(s, 0) -> res => { let _: Result<(), SendError> = res; }, default(ms(0)) => {} } select! { - send(s, 0) -> res => drop::>>(res), - recv(r) -> res => drop::>(res), + send(s, 0) -> res => { let _: Result<(), SendError> = res; }, + recv(r) -> res => { let _: Result = res; }, } } diff --git a/crossbeam-epoch/src/deferred.rs b/crossbeam-epoch/src/deferred.rs index 62c1b7d2e..041955f52 100644 --- a/crossbeam-epoch/src/deferred.rs +++ b/crossbeam-epoch/src/deferred.rs @@ -89,10 +89,9 @@ impl Deferred { #[cfg(all(test, not(crossbeam_loom)))] mod tests { - #![allow(dropping_copy_types)] - use super::Deferred; use std::cell::Cell; + use std::convert::identity; #[test] fn on_stack() { @@ -100,7 +99,7 @@ mod tests { let a = [0usize; 1]; let d = Deferred::new(move || { - drop(a); + let _ = identity(a); fired.set(true); }); @@ -115,7 +114,7 @@ mod tests { let a = [0usize; 10]; let d = Deferred::new(move || { - drop(a); + let _ = identity(a); fired.set(true); });