Remove an unneeded explicit error conversion

This commit is contained in:
Ryan Leckey 2019-08-29 00:45:27 -07:00
parent b4c39b6c7a
commit 5c5d027bf9
2 changed files with 2 additions and 4 deletions

View File

@ -7,7 +7,7 @@ pub fn fetch<'a>(
conn: &'a mut PostgresRawConnection,
) -> impl Stream<Item = Result<PostgresRow, Error>> + '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 {

View File

@ -34,9 +34,7 @@ pub struct PostgresRawConnection {
impl PostgresRawConnection {
async fn establish(url: &str) -> Result<Self, Error> {
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),