From 5c5d027bf94ec0f86ec5554ae5830e68ae06a0ea Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Thu, 29 Aug 2019 00:45:27 -0700 Subject: [PATCH] Remove an unneeded explicit error conversion --- src/postgres/connection/fetch.rs | 2 +- src/postgres/connection/mod.rs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/postgres/connection/fetch.rs b/src/postgres/connection/fetch.rs index 1b5e154c..4b37b1b8 100644 --- a/src/postgres/connection/fetch.rs +++ b/src/postgres/connection/fetch.rs @@ -7,7 +7,7 @@ pub fn fetch<'a>( conn: &'a mut PostgresRawConnection, ) -> impl Stream> + 'a { async_stream::try_stream! { - conn.stream.flush().await.map_err(Error::Io)?; + conn.stream.flush().await.map_err(Error::from)?; while let Some(message) = conn.receive().await? { match message { diff --git a/src/postgres/connection/mod.rs b/src/postgres/connection/mod.rs index f4f8de77..4e31f8eb 100644 --- a/src/postgres/connection/mod.rs +++ b/src/postgres/connection/mod.rs @@ -34,9 +34,7 @@ pub struct PostgresRawConnection { impl PostgresRawConnection { async fn establish(url: &str) -> Result { let url = Url::parse(url); - let stream = TcpStream::connect(&url.address(5432)) - .await - .map_err(Error::Io)?; + let stream = TcpStream::connect(&url.address(5432)).await?; let mut conn = Self { stream: BufStream::new(stream),