Skip to content

Commit e675ee7

Browse files
committed
Minor cleanup
1 parent 9a932d2 commit e675ee7

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

postgres-tokio/src/lib.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ impl InnerConnection {
7070
Either::B(s.read())
7171
}
7272
Some(m) => Either::A(Ok((m, s)).into_future()),
73-
None => Either::A(Err((eof(), s)).into_future()),
73+
None => {
74+
let err = io::Error::new(io::ErrorKind::UnexpectedEof, "unexpected EOF");
75+
Either::A(Err((err, s)).into_future())
76+
}
7477
}
7578
})
7679
.boxed()
@@ -348,21 +351,8 @@ fn connect_err(fields: &mut ErrorFields) -> ConnectError {
348351
}
349352
}
350353

351-
fn err(fields: &mut ErrorFields, conn: Connection) -> Error {
352-
match DbError::new(fields) {
353-
Ok(err) => Error::Db(Box::new(err), conn),
354-
Err(err) => Error::Io(err),
355-
}
356-
}
357-
358354
fn bad_message<T>() -> T
359355
where T: From<io::Error>
360356
{
361357
io::Error::new(io::ErrorKind::InvalidInput, "unexpected message").into()
362358
}
363-
364-
fn eof<T>() -> T
365-
where T: From<io::Error>
366-
{
367-
io::Error::new(io::ErrorKind::UnexpectedEof, "unexpected EOF").into()
368-
}

0 commit comments

Comments
 (0)