1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 19:47:43 +02:00

Fix clippy warnings (#40)

Add explicit `dyn`s

Remove let binding

Use +=

Return false

Derive Default for TcpConnector

Squash if/else

Remove unnecessary return keywords

Use is_empty()

Fix clippy attribute

Allow mut_from_ref
This commit is contained in:
Yuki Okushi
2019-08-17 05:15:51 +09:00
committed by GitHub
parent 7a18d9da26
commit aad013f559
15 changed files with 38 additions and 39 deletions

View File

@ -16,15 +16,15 @@ use copyless::BoxHelper;
thread_local!(
static ADDR: RefCell<Option<Arbiter>> = RefCell::new(None);
static RUNNING: Cell<bool> = Cell::new(false);
static Q: RefCell<Vec<Box<Future<Item = (), Error = ()>>>> = RefCell::new(Vec::new());
static Q: RefCell<Vec<Box<dyn Future<Item = (), Error = ()>>>> = RefCell::new(Vec::new());
);
pub(crate) static COUNT: AtomicUsize = AtomicUsize::new(0);
pub(crate) enum ArbiterCommand {
Stop,
Execute(Box<Future<Item = (), Error = ()> + Send>),
ExecuteFn(Box<FnExec>),
Execute(Box<dyn Future<Item = (), Error = ()> + Send>),
ExecuteFn(Box<dyn FnExec>),
}
impl fmt::Debug for ArbiterCommand {
@ -180,7 +180,7 @@ impl Arbiter {
let _ = self
.0
.unbounded_send(ArbiterCommand::ExecuteFn(Box::new(move || {
let _ = f();
f();
})));
}
@ -312,7 +312,7 @@ impl<F> FnExec for F
where
F: FnOnce() + Send + 'static,
{
#[cfg_attr(feature = "cargo-clippy", allow(boxed_local))]
#[allow(clippy::boxed_local)]
fn call_box(self: Box<Self>) {
(*self)()
}

View File

@ -40,7 +40,7 @@ impl Error for RunError {
fn description(&self) -> &str {
self.inner.description()
}
fn cause(&self) -> Option<&Error> {
fn cause(&self) -> Option<&dyn Error> {
self.inner.source()
}
}