ci: enable clippy lints (#1335)

This commit is contained in:
Taiki Endo
2019-07-26 03:47:14 +09:00
committed by GitHub
parent f311ac3d4f
commit fe021e6c00
54 changed files with 394 additions and 274 deletions
+12 -4
View File
@@ -348,7 +348,7 @@ impl<P: Park> CurrentThread<P> {
}
/// Bind `CurrentThread` instance with an execution context.
fn enter<'a>(&'a mut self) -> Entered<'a, P> {
fn enter(&mut self) -> Entered<'_, P> {
Entered { executor: self }
}
@@ -429,6 +429,12 @@ impl<P: Park> fmt::Debug for CurrentThread<P> {
}
}
impl<P: Park + Default> Default for CurrentThread<P> {
fn default() -> Self {
CurrentThread::new_with_park(P::default())
}
}
// ===== impl Entered =====
impl<'a, P: Park> Entered<'a, P> {
@@ -483,7 +489,7 @@ impl<'a, P: Park> Entered<'a, P> {
self.tick();
if let Err(_) = self.executor.park.park() {
if self.executor.park.park().is_err() {
panic!("block_on park failed");
}
}
@@ -550,7 +556,7 @@ impl<'a, P: Park> Entered<'a, P> {
match time {
Some((until, rem)) => {
if let Err(_) = self.executor.park.park_timeout(rem) {
if self.executor.park.park_timeout(rem).is_err() {
return Err(RunTimeoutError::new(false));
}
@@ -563,7 +569,7 @@ impl<'a, P: Park> Entered<'a, P> {
time = Some((until, until - now));
}
None => {
if let Err(_) = self.executor.park.park() {
if self.executor.park.park().is_err() {
return Err(RunTimeoutError::new(false));
}
}
@@ -790,6 +796,8 @@ impl CurrentRunner {
unsafe fn hide_lt<'a>(p: *mut (dyn SpawnLocal + 'a)) -> *mut (dyn SpawnLocal + 'static) {
use std::mem;
// false positive: https://github.com/rust-lang/rust-clippy/issues/2906
#[allow(clippy::transmute_ptr_to_ptr)]
mem::transmute(p)
}
+5 -7
View File
@@ -443,10 +443,8 @@ impl<U> Inner<U> {
let tail = *self.tail_readiness.get();
let next = (*tail).next_readiness.load(Acquire);
if tail == self.stub() {
if next.is_null() {
return false;
}
if tail == self.stub() && next.is_null() {
return false;
}
true
@@ -566,7 +564,7 @@ impl<U> List<U> {
self.len += 1;
return ptr;
ptr
}
/// Pop an element from the front of the list
@@ -618,7 +616,7 @@ impl<U> List<U> {
self.len -= 1;
return node;
node
}
}
@@ -773,7 +771,7 @@ impl<U> Drop for Node<U> {
fn arc2ptr<T>(ptr: Arc<T>) -> *const T {
let addr = &*ptr as *const T;
mem::forget(ptr);
return addr;
addr
}
unsafe fn ptr2arc<T>(ptr: *const T) -> Arc<T> {