Skip to content

Commit

Permalink
Merge pull request #321 from http-rs/fix-cargo-clippy
Browse files Browse the repository at this point in the history
Fix clippy lints
  • Loading branch information
yoshuawuyts authored Jan 18, 2021
2 parents bcfca5a + 3c83a82 commit a918ed3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/conditional/etag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/headers/header_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/other/retry_after.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ impl RetryAfter {
}
}

impl Into<SystemTime> for RetryAfter {
fn into(self) -> SystemTime {
match self.inner {
impl From<RetryAfter> for SystemTime {
fn from(retry_after: RetryAfter) -> Self {
match retry_after.inner {
RetryDirective::Duration(dur) => SystemTime::now() + dur,
RetryDirective::SystemTime(at) => at,
}
Expand Down
10 changes: 5 additions & 5 deletions src/status_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit a918ed3

Please sign in to comment.