Skip to content

Commit

Permalink
Don't allow(dropping_copy_types)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-Bertholet authored and taiki-e committed Jun 12, 2023
1 parent e784567 commit 1c9af43
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 22 deletions.
6 changes: 1 addition & 5 deletions crossbeam-channel/tests/mpsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 0 additions & 2 deletions crossbeam-channel/tests/ready.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 0 additions & 2 deletions crossbeam-channel/tests/select.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
18 changes: 9 additions & 9 deletions crossbeam-channel/tests/select_macro.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -1212,32 +1212,32 @@ fn result_types() {
let (_, r) = bounded::<i32>(0);

select! {
recv(r) -> res => drop::<Result<i32, RecvError>>(res),
recv(r) -> res => { let _: Result<i32, RecvError> = res; },
}
select! {
recv(r) -> res => drop::<Result<i32, RecvError>>(res),
recv(r) -> res => { let _: Result<i32, RecvError> = res; },
default => {}
}
select! {
recv(r) -> res => drop::<Result<i32, RecvError>>(res),
recv(r) -> res => { let _: Result<i32, RecvError> = res; },
default(ms(0)) => {}
}

select! {
send(s, 0) -> res => drop::<Result<(), SendError<i32>>>(res),
send(s, 0) -> res => { let _: Result<(), SendError<i32>> = res; },
}
select! {
send(s, 0) -> res => drop::<Result<(), SendError<i32>>>(res),
send(s, 0) -> res => { let _: Result<(), SendError<i32>> = res; },
default => {}
}
select! {
send(s, 0) -> res => drop::<Result<(), SendError<i32>>>(res),
send(s, 0) -> res => { let _: Result<(), SendError<i32>> = res; },
default(ms(0)) => {}
}

select! {
send(s, 0) -> res => drop::<Result<(), SendError<i32>>>(res),
recv(r) -> res => drop::<Result<i32, RecvError>>(res),
send(s, 0) -> res => { let _: Result<(), SendError<i32>> = res; },
recv(r) -> res => { let _: Result<i32, RecvError> = res; },
}
}

Expand Down
7 changes: 3 additions & 4 deletions crossbeam-epoch/src/deferred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,17 @@ 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() {
let fired = &Cell::new(false);
let a = [0usize; 1];

let d = Deferred::new(move || {
drop(a);
let _ = identity(a);
fired.set(true);
});

Expand All @@ -115,7 +114,7 @@ mod tests {
let a = [0usize; 10];

let d = Deferred::new(move || {
drop(a);
let _ = identity(a);
fired.set(true);
});

Expand Down

0 comments on commit 1c9af43

Please sign in to comment.