1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 22:07:42 +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

@ -4,7 +4,7 @@ use futures::{Async, Future, IntoFuture, Poll};
use crate::{NewService, Service};
pub type BoxedService<Req, Res, Err> = Box<
Service<
dyn Service<
Request = Req,
Response = Res,
Error = Err,
@ -13,7 +13,7 @@ pub type BoxedService<Req, Res, Err> = Box<
>;
pub type BoxedServiceResponse<Res, Err> =
Either<FutureResult<Res, Err>, Box<Future<Item = Res, Error = Err>>>;
Either<FutureResult<Res, Err>, Box<dyn Future<Item = Res, Error = Err>>>;
pub struct BoxedNewService<C, Req, Res, Err, InitErr>(Inner<C, Req, Res, Err, InitErr>);
@ -46,14 +46,14 @@ where
}
type Inner<C, Req, Res, Err, InitErr> = Box<
NewService<
dyn NewService<
Config = C,
Request = Req,
Response = Res,
Error = Err,
InitError = InitErr,
Service = BoxedService<Req, Res, Err>,
Future = Box<Future<Item = BoxedService<Req, Res, Err>, Error = InitErr>>,
Future = Box<dyn Future<Item = BoxedService<Req, Res, Err>, Error = InitErr>>,
>,
>;
@ -70,7 +70,7 @@ where
type InitError = InitErr;
type Config = C;
type Service = BoxedService<Req, Res, Err>;
type Future = Box<Future<Item = Self::Service, Error = Self::InitError>>;
type Future = Box<dyn Future<Item = Self::Service, Error = Self::InitError>>;
fn new_service(&self, cfg: &C) -> Self::Future {
self.0.new_service(cfg)
@ -99,7 +99,7 @@ where
type InitError = InitErr;
type Config = C;
type Service = BoxedService<Req, Res, Err>;
type Future = Box<Future<Item = Self::Service, Error = Self::InitError>>;
type Future = Box<dyn Future<Item = Self::Service, Error = Self::InitError>>;
fn new_service(&self, cfg: &C) -> Self::Future {
Box::new(
@ -133,7 +133,7 @@ where
type Error = Err;
type Future = Either<
FutureResult<Self::Response, Self::Error>,
Box<Future<Item = Self::Response, Error = Self::Error>>,
Box<dyn Future<Item = Self::Response, Error = Self::Error>>,
>;
fn poll_ready(&mut self) -> Poll<(), Self::Error> {

View File

@ -34,6 +34,7 @@ impl<T> Cell<T> {
unsafe { &mut *self.inner.as_ref().get() }
}
#[allow(clippy::mut_from_ref)]
pub(crate) unsafe fn get_mut_unsafe(&self) -> &mut T {
&mut *self.inner.as_ref().get()
}