Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy lints #321

Merged
merged 2 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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