From 5d403b5e58bc5b4a8dfc079bbbcd9232c53bd090 Mon Sep 17 00:00:00 2001 From: Jayson Reis Date: Mon, 11 Apr 2016 16:07:29 +0200 Subject: [PATCH] Upgrade byteorder to 0.5.1 --- Cargo.toml | 2 +- src/result.rs | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4579eaa57f..3a18f397ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ url = "0.5.0" rustc-serialize = "0.3.16" bitflags = "0.3.3" rand = "0.3.12" -byteorder = "0.4.2" +byteorder = "0.5.1" net2 = "0.2.17" [features] diff --git a/src/result.rs b/src/result.rs index 833efc1713..f6b9b25fa8 100644 --- a/src/result.rs +++ b/src/result.rs @@ -8,7 +8,6 @@ use std::fmt; use openssl::ssl::error::SslError; use hyper::Error as HttpError; use url::ParseError; -use byteorder; /// The type used for WebSocket results pub type WebSocketResult = Result; @@ -80,6 +79,9 @@ impl Error for WebSocketError { impl From for WebSocketError { fn from(err: io::Error) -> WebSocketError { + if err.kind() == io::ErrorKind::UnexpectedEof { + return WebSocketError::NoDataAvailable; + } WebSocketError::IoError(err) } } @@ -108,15 +110,6 @@ impl From for WebSocketError { } } -impl From for WebSocketError { - fn from(err: byteorder::Error) -> WebSocketError { - match err { - byteorder::Error::UnexpectedEOF => WebSocketError::NoDataAvailable, - byteorder::Error::Io(err) => From::from(err) - } - } -} - impl From for WebSocketError { fn from(err: WSUrlErrorKind) -> WebSocketError { WebSocketError::WebSocketUrlError(err)