refactor(lib): fix many lint warnings
This commit is contained in:
@@ -13,7 +13,7 @@ pub trait MakeService<Target, ReqBody>: sealed::Sealed<Target, ReqBody> {
|
||||
/// The error type that can be returned by `Service`s.
|
||||
type Error: Into<Box<dyn StdError + Send + Sync>>;
|
||||
|
||||
/// The resolved `Service` from `new_service()`.
|
||||
/// The resolved `Service` from `make_service()`.
|
||||
type Service: Service<
|
||||
ReqBody,
|
||||
ResBody=Self::ResBody,
|
||||
@@ -31,16 +31,14 @@ pub trait MakeService<Target, ReqBody>: sealed::Sealed<Target, ReqBody> {
|
||||
/// The implementation of this method is allowed to return a `Ready` even if
|
||||
/// the factory is not ready to create a new service. In this case, the future
|
||||
/// returned from `make_service` will resolve to an error.
|
||||
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::MakeError>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::MakeError>>;
|
||||
|
||||
/// Create a new `Service`.
|
||||
fn make_service(&mut self, target: Target) -> Self::Future;
|
||||
}
|
||||
|
||||
impl<T, Target, S, B1, B2, E, F> MakeService<Target, B1> for T
|
||||
where
|
||||
impl<T, Target, S, B1, B2, E, F> MakeService<Target, B1> for T
|
||||
where
|
||||
T: for<'a> tower_service::Service<&'a Target, Response = S, Error = E, Future = F>,
|
||||
S: tower_service::Service<crate::Request<B1>, Response = crate::Response<B2>>,
|
||||
E: Into<Box<dyn std::error::Error + Send + Sync>>,
|
||||
@@ -191,7 +189,7 @@ where
|
||||
type Response = Svc;
|
||||
type Future = Ret;
|
||||
|
||||
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
fn poll_ready(&mut self, _cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::body::Payload;
|
||||
use crate::common::{Future, Never, Poll, task};
|
||||
use crate::common::{Future, Poll, task};
|
||||
use crate::{Request, Response};
|
||||
|
||||
/// An asynchronous function from `Request` to `Response`.
|
||||
@@ -26,15 +26,13 @@ pub trait Service<ReqBody>: sealed::Sealed<ReqBody> {
|
||||
/// The implementation of this method is allowed to return a `Ready` even if
|
||||
/// the service is not ready to process. In this case, the future returned
|
||||
/// from `call` will resolve to an error.
|
||||
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>>;
|
||||
|
||||
/// Calls this `Service` with a request, returning a `Future` of the response.
|
||||
fn call(&mut self, req: Request<ReqBody>) -> Self::Future;
|
||||
}
|
||||
|
||||
impl<T, B1, B2> Service<B1> for T
|
||||
impl<T, B1, B2> Service<B1> for T
|
||||
where
|
||||
T: tower_service::Service<Request<B1>, Response = Response<B2>>,
|
||||
B2: Payload,
|
||||
@@ -112,7 +110,7 @@ where
|
||||
type Error = E;
|
||||
type Future = Ret;
|
||||
|
||||
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
fn poll_ready(&mut self, _cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user