diff --git a/src/conditional/etag.rs b/src/conditional/etag.rs index 00d59194..548e4bdb 100644 --- a/src/conditional/etag.rs +++ b/src/conditional/etag.rs @@ -117,7 +117,7 @@ impl ETag { if !s .bytes() - .all(|c| c == 0x21 || (c >= 0x23 && c <= 0x7E) || c >= 0x80) + .all(|c| c == 0x21 || (0x23..=0x7E).contains(&c) || c >= 0x80) { return Err(Error::from_str( StatusCode::BadRequest, diff --git a/src/headers/header_name.rs b/src/headers/header_name.rs index 2d584e3d..d4eb21be 100644 --- a/src/headers/header_name.rs +++ b/src/headers/header_name.rs @@ -135,6 +135,7 @@ mod tests { use super::*; #[test] + #[allow(clippy::eq_op)] fn test_header_name_static_non_static() { let static_header = HeaderName::from_lowercase_str("hello"); let non_static_header = HeaderName::from_str("hello").unwrap(); diff --git a/src/other/retry_after.rs b/src/other/retry_after.rs index 295c0184..bfe81f22 100644 --- a/src/other/retry_after.rs +++ b/src/other/retry_after.rs @@ -109,9 +109,9 @@ impl RetryAfter { } } -impl Into for RetryAfter { - fn into(self) -> SystemTime { - match self.inner { +impl From for SystemTime { + fn from(retry_after: RetryAfter) -> Self { + match retry_after.inner { RetryDirective::Duration(dur) => SystemTime::now() + dur, RetryDirective::SystemTime(at) => at, } diff --git a/src/status_code.rs b/src/status_code.rs index 749e9128..b98ee9bd 100644 --- a/src/status_code.rs +++ b/src/status_code.rs @@ -434,7 +434,7 @@ impl StatusCode { /// continuing process. pub fn is_informational(&self) -> bool { let num: u16 = self.clone().into(); - num >= 100 && num < 200 + (100..200).contains(&num) } /// Returns `true` if the status code is the `2xx` range. @@ -443,7 +443,7 @@ impl StatusCode { /// received, understood, and accepted. pub fn is_success(&self) -> bool { let num: u16 = self.clone().into(); - num >= 200 && num < 300 + (200..300).contains(&num) } /// Returns `true` if the status code is the `3xx` range. @@ -452,7 +452,7 @@ impl StatusCode { /// taken in order to complete the request. pub fn is_redirection(&self) -> bool { let num: u16 = self.clone().into(); - num >= 300 && num < 400 + (300..400).contains(&num) } /// Returns `true` if the status code is the `4xx` range. @@ -461,7 +461,7 @@ impl StatusCode { /// or cannot be fulfilled. pub fn is_client_error(&self) -> bool { let num: u16 = self.clone().into(); - num >= 400 && num < 500 + (400..500).contains(&num) } /// Returns `true` if the status code is the `5xx` range. @@ -470,7 +470,7 @@ impl StatusCode { /// apparently valid request. pub fn is_server_error(&self) -> bool { let num: u16 = self.clone().into(); - num >= 500 && num < 600 + (500..600).contains(&num) } /// The canonical reason for a given status code