diff --git a/src/client/request.rs b/src/client/request.rs index 2128f76d45..da91320fb5 100644 --- a/src/client/request.rs +++ b/src/client/request.rs @@ -36,7 +36,7 @@ impl Request { /// Read the Request Version. #[inline] - pub fn version(&self) -> &HttpVersion { &self.version } + pub fn version(&self) -> HttpVersion { self.version } /// Read the Request headers. #[inline] diff --git a/src/client/response.rs b/src/client/response.rs index 8249dbddd2..3db0ae136f 100644 --- a/src/client/response.rs +++ b/src/client/response.rs @@ -37,7 +37,7 @@ impl Response { /// Get the status from the server. #[inline] - pub fn status(&self) -> &status::StatusCode { &self.status } + pub fn status(&self) -> status::StatusCode { self.status } /// Get the raw status code and reason. #[inline] @@ -45,7 +45,7 @@ impl Response { /// Get the HTTP version of this response from the server. #[inline] - pub fn version(&self) -> &version::HttpVersion { &self.version } + pub fn version(&self) -> version::HttpVersion { self.version } /// Take the `Body` of this response. #[inline] diff --git a/src/server/request.rs b/src/server/request.rs index c998097078..136f47149f 100644 --- a/src/server/request.rs +++ b/src/server/request.rs @@ -37,14 +37,14 @@ impl Request { /// The version of HTTP for this request. #[inline] - pub fn version(&self) -> &HttpVersion { &self.version } + pub fn version(&self) -> HttpVersion { self.version } /// The remote socket address of this request /// /// This is an `Option`, because some underlying transports may not have /// a socket address, such as Unix Sockets. #[inline] - pub fn remote_addr(&self) -> Option<&SocketAddr> { self.remote_addr.as_ref() } + pub fn remote_addr(&self) -> Option { self.remote_addr } /// The target path of this Request. #[inline] diff --git a/src/server/response.rs b/src/server/response.rs index 57686e1862..4acb55132a 100644 --- a/src/server/response.rs +++ b/src/server/response.rs @@ -26,13 +26,13 @@ impl Response { /// The status of this response. #[inline] - pub fn status(&self) -> &StatusCode { - &self.head.subject + pub fn status(&self) -> StatusCode { + self.head.subject } /// The HTTP version of this response. #[inline] - pub fn version(&self) -> &version::HttpVersion { &self.head.version } + pub fn version(&self) -> version::HttpVersion { self.head.version } /// Get a mutable reference to the Headers. #[inline] diff --git a/src/status.rs b/src/status.rs index 71d40b5c3c..cbab52a805 100644 --- a/src/status.rs +++ b/src/status.rs @@ -550,9 +550,9 @@ impl Default for StatusCode { } } -impl Into for StatusCode { - fn into(self) -> u16 { - self.to_u16() +impl From for u16 { + fn from(code: StatusCode) -> u16 { + code.to_u16() } } diff --git a/tests/client.rs b/tests/client.rs index 000b9e5f51..30c9e46361 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -89,7 +89,7 @@ macro_rules! test { let work = res.join(rx).map(|r| r.0); let res = core.run(work).unwrap(); - assert_eq!(res.status(), &StatusCode::$client_status, "status is invalid"); + assert_eq!(res.status(), StatusCode::$client_status, "status is invalid"); $( assert_eq!(res.headers().get(), Some(&$response_headers), "headers are invalid"); )*