diff --git a/Cargo.toml b/Cargo.toml index 1e9230b0..53a949b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,9 +21,6 @@ lazy_static = "1.0" # Used when testing out serde support. bincode = {version = "1.1.3"} -[build-dependencies] -autocfg = "0.1.6" - [features] default = [] owning_ref = ["lock_api/owning_ref"] diff --git a/core/Cargo.toml b/core/Cargo.toml index b195cd9d..f461ae10 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -16,9 +16,6 @@ petgraph = { version = "0.4.5", optional = true } thread-id = { version = "3.2.0", optional = true } backtrace = { version = "0.3.2", optional = true } -[build-dependencies] -autocfg = "0.1.6" - [target.'cfg(unix)'.dependencies] libc = "0.2.55" diff --git a/src/condvar.rs b/src/condvar.rs index c99f2eb6..149ec867 100644 --- a/src/condvar.rs +++ b/src/condvar.rs @@ -24,7 +24,7 @@ pub struct WaitTimeoutResult(bool); impl WaitTimeoutResult { /// Returns whether the wait was known to have timed out. #[inline] - pub fn timed_out(&self) -> bool { + pub fn timed_out(self) -> bool { self.0 } } @@ -618,7 +618,7 @@ mod tests { rx.recv().unwrap(); let _g = m.lock(); let _guard = PanicGuard(&*c); - let _ = c.wait(&mut m3.lock()); + c.wait(&mut m3.lock()); } #[test] @@ -917,7 +917,7 @@ mod webkit_queue_test { num_producers: 1, num_consumers: 1, max_queue_size: 1, - messages_per_producer: 100000, + messages_per_producer: 100_000, notification_style: NotifyStyle::All, timeout: Timeout::Bounded(Duration::from_secs(1)), delay_seconds: 0 @@ -926,7 +926,7 @@ mod webkit_queue_test { num_producers: 1, num_consumers: 1, max_queue_size: 1, - messages_per_producer: 100000, + messages_per_producer: 100_000, notification_style: NotifyStyle::All, timeout: Timeout::Forever, delay_seconds: 0 @@ -935,7 +935,7 @@ mod webkit_queue_test { num_producers: 1, num_consumers: 5, max_queue_size: 1, - messages_per_producer: 100000, + messages_per_producer: 100_000, notification_style: NotifyStyle::All, timeout: Timeout::Forever, delay_seconds: 0 @@ -944,7 +944,7 @@ mod webkit_queue_test { num_producers: 1, num_consumers: 1, max_queue_size: 1, - messages_per_producer: 100000, + messages_per_producer: 100_000, notification_style: NotifyStyle::All, timeout: Timeout::Forever, delay_seconds: 0 @@ -953,7 +953,7 @@ mod webkit_queue_test { num_producers: 1, num_consumers: 1, max_queue_size: 1, - messages_per_producer: 100000, + messages_per_producer: 100_000, notification_style: NotifyStyle::All, timeout: Timeout::Forever, delay_seconds: 1 @@ -962,7 +962,7 @@ mod webkit_queue_test { num_producers: 1, num_consumers: 1, max_queue_size: 100, - messages_per_producer: 1000000, + messages_per_producer: 1_000_000, notification_style: NotifyStyle::All, timeout: Timeout::Forever, delay_seconds: 0 @@ -1007,7 +1007,7 @@ mod webkit_queue_test { num_producers: 1, num_consumers: 10, max_queue_size: 100, - messages_per_producer: 100000, + messages_per_producer: 100_000, notification_style: NotifyStyle::All, timeout: Timeout::Forever, delay_seconds: 0 @@ -1016,7 +1016,7 @@ mod webkit_queue_test { num_producers: 1, num_consumers: 10, max_queue_size: 100, - messages_per_producer: 100000, + messages_per_producer: 100_000, notification_style: NotifyStyle::One, timeout: Timeout::Forever, delay_seconds: 0 diff --git a/src/mutex.rs b/src/mutex.rs index 4f88e583..82f1fe5d 100644 --- a/src/mutex.rs +++ b/src/mutex.rs @@ -245,7 +245,7 @@ mod tests { fn test_mutex_arc_access_in_unwind() { let arc = Arc::new(Mutex::new(1)); let arc2 = arc.clone(); - let _ = thread::spawn(move || -> () { + let _ = thread::spawn(move || { struct Unwinder { i: Arc>, } diff --git a/src/once.rs b/src/once.rs index ae6f2bcd..f458c9c0 100644 --- a/src/once.rs +++ b/src/once.rs @@ -39,8 +39,8 @@ impl OnceState { /// Once an initialization routine for a `Once` has panicked it will forever /// indicate to future forced initialization routines that it is poisoned. #[inline] - pub fn poisoned(&self) -> bool { - match *self { + pub fn poisoned(self) -> bool { + match self { OnceState::Poisoned => true, _ => false, } @@ -49,8 +49,8 @@ impl OnceState { /// Returns whether the associated `Once` has successfully executed a /// closure. #[inline] - pub fn done(&self) -> bool { - match *self { + pub fn done(self) -> bool { + match self { OnceState::Done => true, _ => false, } diff --git a/src/remutex.rs b/src/remutex.rs index 615232ed..6fdf107d 100644 --- a/src/remutex.rs +++ b/src/remutex.rs @@ -69,18 +69,18 @@ mod tests { #[test] fn smoke() { - let m = ReentrantMutex::new(()); + let m = ReentrantMutex::new(2); { let a = m.lock(); { let b = m.lock(); { let c = m.lock(); - assert_eq!(*c, ()); + assert_eq!(*c, 2); } - assert_eq!(*b, ()); + assert_eq!(*b, 2); } - assert_eq!(*a, ()); + assert_eq!(*a, 2); } } diff --git a/src/rwlock.rs b/src/rwlock.rs index fbfb39f2..776cec06 100644 --- a/src/rwlock.rs +++ b/src/rwlock.rs @@ -322,7 +322,7 @@ mod tests { fn test_rw_arc_access_in_unwind() { let arc = Arc::new(RwLock::new(1)); let arc2 = arc.clone(); - let _ = thread::spawn(move || -> () { + let _ = thread::spawn(move || { struct Unwinder { i: Arc>, }