From e784567e0bf306397479cf29b870d1848541f0f1 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Thu, 25 May 2023 15:57:44 -0400 Subject: [PATCH] chore: rename `dropping_copy_types` lint CI needs to be appeased --- crossbeam-channel/tests/mpsc.rs | 2 +- crossbeam-channel/tests/ready.rs | 2 +- crossbeam-channel/tests/select.rs | 2 +- crossbeam-channel/tests/select_macro.rs | 2 +- crossbeam-epoch/src/deferred.rs | 2 +- crossbeam-skiplist/src/base.rs | 8 ++++---- crossbeam-utils/src/sync/sharded_lock.rs | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crossbeam-channel/tests/mpsc.rs b/crossbeam-channel/tests/mpsc.rs index d7cc8e25f..6a297c5b8 100644 --- a/crossbeam-channel/tests/mpsc.rs +++ b/crossbeam-channel/tests/mpsc.rs @@ -21,7 +21,7 @@ //! - https://www.rust-lang.org/en-US/legal.html #![allow( - clippy::drop_copy, + dropping_copy_types, clippy::match_single_binding, clippy::redundant_clone )] diff --git a/crossbeam-channel/tests/ready.rs b/crossbeam-channel/tests/ready.rs index 6e3fb2b64..bb2b9ce62 100644 --- a/crossbeam-channel/tests/ready.rs +++ b/crossbeam-channel/tests/ready.rs @@ -1,6 +1,6 @@ //! Tests for channel readiness using the `Select` struct. -#![allow(clippy::drop_copy)] +#![allow(dropping_copy_types)] use std::any::Any; use std::cell::Cell; diff --git a/crossbeam-channel/tests/select.rs b/crossbeam-channel/tests/select.rs index bc5824dab..ae136d25b 100644 --- a/crossbeam-channel/tests/select.rs +++ b/crossbeam-channel/tests/select.rs @@ -1,6 +1,6 @@ //! Tests for channel selection using the `Select` struct. -#![allow(clippy::drop_copy)] +#![allow(dropping_copy_types)] use std::any::Any; use std::cell::Cell; diff --git a/crossbeam-channel/tests/select_macro.rs b/crossbeam-channel/tests/select_macro.rs index 119454cd6..e00c7929d 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(clippy::drop_copy, clippy::match_single_binding)] +#![allow(dropping_copy_types, clippy::match_single_binding)] use std::any::Any; use std::cell::Cell; diff --git a/crossbeam-epoch/src/deferred.rs b/crossbeam-epoch/src/deferred.rs index 2f3d79fdf..62c1b7d2e 100644 --- a/crossbeam-epoch/src/deferred.rs +++ b/crossbeam-epoch/src/deferred.rs @@ -89,7 +89,7 @@ impl Deferred { #[cfg(all(test, not(crossbeam_loom)))] mod tests { - #![allow(clippy::drop_copy)] + #![allow(dropping_copy_types)] use super::Deferred; use std::cell::Cell; diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs index d27c531b5..6d5514d81 100644 --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -1768,10 +1768,10 @@ impl<'a, K: 'a, V: 'a> RefIter<'a, K, V> { /// Decrements the reference count of `RefEntry` owned by the iterator. pub fn drop_impl(&mut self, guard: &Guard) { self.parent.check_guard(guard); - if let Some(e) = mem::replace(&mut self.head, None) { + if let Some(e) = self.head.take() { unsafe { e.node.decrement(guard) }; } - if let Some(e) = mem::replace(&mut self.tail, None) { + if let Some(e) = self.tail.take() { unsafe { e.node.decrement(guard) }; } } @@ -1985,10 +1985,10 @@ where /// Decrements a reference count owned by this iterator. pub fn drop_impl(&mut self, guard: &Guard) { self.parent.check_guard(guard); - if let Some(e) = mem::replace(&mut self.head, None) { + if let Some(e) = self.head.take() { unsafe { e.node.decrement(guard) }; } - if let Some(e) = mem::replace(&mut self.tail, None) { + if let Some(e) = self.tail.take() { unsafe { e.node.decrement(guard) }; } } diff --git a/crossbeam-utils/src/sync/sharded_lock.rs b/crossbeam-utils/src/sync/sharded_lock.rs index a8f4584e3..5aee56f88 100644 --- a/crossbeam-utils/src/sync/sharded_lock.rs +++ b/crossbeam-utils/src/sync/sharded_lock.rs @@ -356,7 +356,7 @@ impl ShardedLock { for shard in self.shards[0..i].iter().rev() { unsafe { let dest: *mut _ = shard.write_guard.get(); - let guard = mem::replace(&mut *dest, None); + let guard = (*dest).take(); drop(guard); } } @@ -526,7 +526,7 @@ impl Drop for ShardedLockWriteGuard<'_, T> { for shard in self.lock.shards.iter().rev() { unsafe { let dest: *mut _ = shard.write_guard.get(); - let guard = mem::replace(&mut *dest, None); + let guard = (*dest).take(); drop(guard); } }