committed by
Lucio Franco
parent
cd0b8424b9
commit
56e89385b3
@@ -93,7 +93,7 @@ impl<T> Grpc<T> {
|
||||
let message = body
|
||||
.try_next()
|
||||
.await?
|
||||
.ok_or(Status::new(Code::Internal, "Missing response message."))?;
|
||||
.ok_or_else(|| Status::new(Code::Internal, "Missing response message."))?;
|
||||
|
||||
if let Some(trailers) = body.trailers().await? {
|
||||
parts.merge(trailers);
|
||||
|
||||
@@ -117,7 +117,7 @@ where
|
||||
}
|
||||
|
||||
fn poll_data(
|
||||
mut self: Pin<&mut Self>,
|
||||
self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
) -> Poll<Option<Result<Self::Data, Self::Error>>> {
|
||||
let mut self_proj = self.project();
|
||||
@@ -135,7 +135,7 @@ where
|
||||
}
|
||||
|
||||
fn poll_trailers(
|
||||
mut self: Pin<&mut Self>,
|
||||
self: Pin<&mut Self>,
|
||||
_cx: &mut Context<'_>,
|
||||
) -> Poll<Result<Option<HeaderMap>, Status>> {
|
||||
match self.role {
|
||||
|
||||
@@ -150,7 +150,7 @@ impl self::value_encoding::Sealed for Binary {
|
||||
if decoded_a.is_ok() && decoded_b.is_ok() {
|
||||
decoded_a.unwrap() == decoded_b.unwrap()
|
||||
} else {
|
||||
!decoded_a.is_ok() && !decoded_b.is_ok()
|
||||
decoded_a.is_err() && decoded_b.is_err()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1265,7 +1265,7 @@ impl<'a, VE: ValueEncoding> Iterator for ValueDrain<'a, VE> {
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
self.inner
|
||||
.next()
|
||||
.map(|value| MetadataValue::unchecked_from_header_value(value))
|
||||
.map(MetadataValue::unchecked_from_header_value)
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
|
||||
@@ -362,7 +362,7 @@ impl MetadataValue<Ascii> {
|
||||
/// assert_eq!(val.to_str().unwrap(), "hello");
|
||||
/// ```
|
||||
pub fn to_str(&self) -> Result<&str, ToStrError> {
|
||||
return self.inner.to_str().map_err(|_| ToStrError::new());
|
||||
self.inner.to_str().map_err(|_| ToStrError::new())
|
||||
}
|
||||
|
||||
/// Converts a `MetadataValue` to a byte slice. For Binary values, use
|
||||
@@ -628,7 +628,7 @@ impl<VE: ValueEncoding> PartialOrd<MetadataValue<VE>> for [u8] {
|
||||
impl<VE: ValueEncoding> PartialEq<String> for MetadataValue<VE> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &String) -> bool {
|
||||
*self == &other[..]
|
||||
*self == other[..]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ where
|
||||
let message = stream
|
||||
.try_next()
|
||||
.await?
|
||||
.ok_or(Status::new(Code::Internal, "Missing request message."))?;
|
||||
.ok_or_else(|| Status::new(Code::Internal, "Missing request message."))?;
|
||||
|
||||
let mut req = Request::from_http_parts(parts, message);
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ impl Server {
|
||||
let f = f.clone();
|
||||
tower::service_fn(move |req| f(&mut s, req))
|
||||
});
|
||||
let layer = Stack::new(interceptor, layer_fn(|s| BoxService::new(s)));
|
||||
let layer = Stack::new(interceptor, layer_fn(BoxService::new));
|
||||
self.interceptor = Some(Arc::new(layer));
|
||||
self
|
||||
}
|
||||
@@ -159,7 +159,7 @@ impl Server {
|
||||
S::Error: Into<crate::Error> + Send,
|
||||
{
|
||||
let interceptor = self.interceptor.clone();
|
||||
let concurrency_limit = self.concurrency_limit.clone();
|
||||
let concurrency_limit = self.concurrency_limit;
|
||||
// let timeout = self.timeout.clone();
|
||||
|
||||
let incoming = hyper::server::accept::from_stream(async_stream::try_stream! {
|
||||
@@ -280,7 +280,7 @@ where
|
||||
fn call(&mut self, _: T) -> Self::Future {
|
||||
let interceptor = self.interceptor.clone();
|
||||
let make = self.inner.make_service(());
|
||||
let concurrency_limit = self.concurrency_limit.clone();
|
||||
let concurrency_limit = self.concurrency_limit;
|
||||
// let timeout = self.timeout.clone();
|
||||
|
||||
Box::pin(async move {
|
||||
|
||||
@@ -38,11 +38,11 @@ impl Connection {
|
||||
|
||||
let stack = ServiceBuilder::new()
|
||||
.layer_fn(|s| AddOrigin::new(s, endpoint.uri.clone()))
|
||||
.optional_layer(endpoint.timeout.map(|t| TimeoutLayer::new(t)))
|
||||
.optional_layer(endpoint.timeout.map(TimeoutLayer::new))
|
||||
.optional_layer(
|
||||
endpoint
|
||||
.concurrency_limit
|
||||
.map(|l| ConcurrencyLimitLayer::new(l)),
|
||||
.map(ConcurrencyLimitLayer::new),
|
||||
)
|
||||
.optional_layer(endpoint.rate_limit.map(|(l, d)| RateLimitLayer::new(l, d)))
|
||||
.into_inner();
|
||||
|
||||
@@ -30,7 +30,7 @@ impl<L> ServiceBuilderExt<L> for ServiceBuilder<L> {
|
||||
F: Fn(S) -> Out,
|
||||
{
|
||||
let layer = OptionalLayer {
|
||||
inner: f.map(|f| LayerFn(f)),
|
||||
inner: f.map(LayerFn),
|
||||
};
|
||||
|
||||
self.layer(layer)
|
||||
|
||||
Reference in New Issue
Block a user