1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-22 16:16:40 +00:00

remove Display from server service Error

This commit is contained in:
Nikolay Kim 2018-09-07 14:34:31 -07:00
parent d4808acee1
commit 0fdce01375
5 changed files with 15 additions and 11 deletions

View file

@ -349,7 +349,7 @@ where
self.a = Some(service); self.a = Some(service);
} }
if let Async::Ready(service) = self.fut_b.poll().map_err(|e| e.into())? { if let Async::Ready(service) = self.fut_b.poll()? {
self.b = Some(service); self.b = Some(service);
} }

View file

@ -8,6 +8,14 @@
//! //!
// #![warn(missing_docs)] // #![warn(missing_docs)]
#![cfg_attr(
feature = "cargo-clippy",
allow(
declare_interior_mutable_const,
borrow_interior_mutable_const
)
)]
#[macro_use] #[macro_use]
extern crate log; extern crate log;
extern crate bytes; extern crate bytes;

View file

@ -1,5 +1,5 @@
use std::time::Duration; use std::time::Duration;
use std::{fmt, io, mem, net}; use std::{io, mem, net};
use futures::sync::{mpsc, mpsc::unbounded}; use futures::sync::{mpsc, mpsc::unbounded};
use futures::{Future, Sink, Stream}; use futures::{Future, Sink, Stream};
@ -150,7 +150,6 @@ impl Server {
N: NewService<Request = TcpStream, Response = (), InitError = ()> + 'static, N: NewService<Request = TcpStream, Response = (), InitError = ()> + 'static,
N::Service: 'static, N::Service: 'static,
N::Future: 'static, N::Future: 'static,
N::Error: fmt::Display,
{ {
let sockets = bind_addr(addr)?; let sockets = bind_addr(addr)?;
@ -167,7 +166,6 @@ impl Server {
N: NewService<Request = TcpStream, Response = (), InitError = ()> + 'static, N: NewService<Request = TcpStream, Response = (), InitError = ()> + 'static,
N::Service: 'static, N::Service: 'static,
N::Future: 'static, N::Future: 'static,
N::Error: fmt::Display,
{ {
let token = Token(self.services.len()); let token = Token(self.services.len());
self.services.push(ServerNewService::create(factory)); self.services.push(ServerNewService::create(factory));

View file

@ -1,7 +1,7 @@
use std::cell::Cell; use std::cell::Cell;
use std::net;
use std::rc::Rc; use std::rc::Rc;
use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::atomic::{AtomicUsize, Ordering};
use std::{fmt, net};
use futures::future::{err, ok}; use futures::future::{err, ok};
use futures::task::AtomicTask; use futures::task::AtomicTask;
@ -64,7 +64,7 @@ impl<T> Service for ServerService<T>
where where
T: Service<Request = TcpStream, Response = ()>, T: Service<Request = TcpStream, Response = ()>,
T::Future: 'static, T::Future: 'static,
T::Error: fmt::Display + 'static, T::Error: 'static,
{ {
type Request = ServerMessage; type Request = ServerMessage;
type Response = (); type Response = ();
@ -117,7 +117,6 @@ where
T: NewService<Request = TcpStream, Response = (), InitError = ()> + 'static, T: NewService<Request = TcpStream, Response = (), InitError = ()> + 'static,
T::Service: 'static, T::Service: 'static,
T::Future: 'static, T::Future: 'static,
T::Error: fmt::Display,
{ {
pub(crate) fn create(inner: F) -> Box<ServerServiceFactory + Send> { pub(crate) fn create(inner: F) -> Box<ServerServiceFactory + Send> {
Box::new(Self { inner }) Box::new(Self { inner })
@ -136,7 +135,6 @@ where
T: NewService<Request = TcpStream, Response = (), InitError = ()> + 'static, T: NewService<Request = TcpStream, Response = (), InitError = ()> + 'static,
T::Service: 'static, T::Service: 'static,
T::Future: 'static, T::Future: 'static,
T::Error: fmt::Display,
{ {
fn clone_factory(&self) -> Box<ServerServiceFactory + Send> { fn clone_factory(&self) -> Box<ServerServiceFactory + Send> {
Box::new(Self { Box::new(Self {

View file

@ -51,7 +51,7 @@ where
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
match self.a.poll_ready() { match self.a.poll_ready() {
Ok(Async::Ready(_)) => self.b.borrow_mut().poll_ready().map_err(|e| e.into()), Ok(Async::Ready(_)) => self.b.borrow_mut().poll_ready(),
Ok(Async::NotReady) => Ok(Async::NotReady), Ok(Async::NotReady) => Ok(Async::NotReady),
Err(err) => Err(err), Err(err) => Err(err),
} }
@ -97,7 +97,7 @@ where
fn poll(&mut self) -> Poll<Self::Item, Self::Error> { fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
if let Some(ref mut fut) = self.fut_b { if let Some(ref mut fut) = self.fut_b {
return fut.poll().map_err(|e| e.into()); return fut.poll();
} }
match self.fut_a.poll() { match self.fut_a.poll() {
@ -204,7 +204,7 @@ where
} }
if self.b.is_none() { if self.b.is_none() {
if let Async::Ready(service) = self.fut_b.poll().map_err(|e| e.into())? { if let Async::Ready(service) = self.fut_b.poll()? {
self.b = Some(service); self.b = Some(service);
} }
} }