refactor(server): remove double nested listen errors in from_tcp

This commit is contained in:
Sean McArthur
2018-08-08 11:23:37 -07:00
parent bb4c5e24c8
commit 0ea3b836f9
2 changed files with 12 additions and 25 deletions

View File

@@ -121,13 +121,10 @@ impl Server<AddrIncoming, ()> {
}
/// Create a new instance from a `std::net::TcpListener` instance.
pub fn from_tcp(
listener: StdTcpListener,
) -> Result<Builder<AddrIncoming>, ::Error> {
pub fn from_tcp(listener: StdTcpListener) -> Result<Builder<AddrIncoming>, ::Error> {
let handle = tokio_reactor::Handle::current();
let incoming = AddrIncoming::from_tcp(listener, &handle)
.map_err(|err| ::Error::new_listen(err))?;
Ok(Self::builder(incoming))
AddrIncoming::from_std(listener, &handle)
.map(Server::builder)
}
}