Skip to content

Commit a918ed3

Browse files
authored
Merge pull request #321 from http-rs/fix-cargo-clippy
Fix clippy lints
2 parents bcfca5a + 3c83a82 commit a918ed3

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

src/conditional/etag.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl ETag {
117117

118118
if !s
119119
.bytes()
120-
.all(|c| c == 0x21 || (c >= 0x23 && c <= 0x7E) || c >= 0x80)
120+
.all(|c| c == 0x21 || (0x23..=0x7E).contains(&c) || c >= 0x80)
121121
{
122122
return Err(Error::from_str(
123123
StatusCode::BadRequest,

src/headers/header_name.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ mod tests {
135135
use super::*;
136136

137137
#[test]
138+
#[allow(clippy::eq_op)]
138139
fn test_header_name_static_non_static() {
139140
let static_header = HeaderName::from_lowercase_str("hello");
140141
let non_static_header = HeaderName::from_str("hello").unwrap();

src/other/retry_after.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ impl RetryAfter {
109109
}
110110
}
111111

112-
impl Into<SystemTime> for RetryAfter {
113-
fn into(self) -> SystemTime {
114-
match self.inner {
112+
impl From<RetryAfter> for SystemTime {
113+
fn from(retry_after: RetryAfter) -> Self {
114+
match retry_after.inner {
115115
RetryDirective::Duration(dur) => SystemTime::now() + dur,
116116
RetryDirective::SystemTime(at) => at,
117117
}

src/status_code.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ impl StatusCode {
434434
/// continuing process.
435435
pub fn is_informational(&self) -> bool {
436436
let num: u16 = self.clone().into();
437-
num >= 100 && num < 200
437+
(100..200).contains(&num)
438438
}
439439

440440
/// Returns `true` if the status code is the `2xx` range.
@@ -443,7 +443,7 @@ impl StatusCode {
443443
/// received, understood, and accepted.
444444
pub fn is_success(&self) -> bool {
445445
let num: u16 = self.clone().into();
446-
num >= 200 && num < 300
446+
(200..300).contains(&num)
447447
}
448448

449449
/// Returns `true` if the status code is the `3xx` range.
@@ -452,7 +452,7 @@ impl StatusCode {
452452
/// taken in order to complete the request.
453453
pub fn is_redirection(&self) -> bool {
454454
let num: u16 = self.clone().into();
455-
num >= 300 && num < 400
455+
(300..400).contains(&num)
456456
}
457457

458458
/// Returns `true` if the status code is the `4xx` range.
@@ -461,7 +461,7 @@ impl StatusCode {
461461
/// or cannot be fulfilled.
462462
pub fn is_client_error(&self) -> bool {
463463
let num: u16 = self.clone().into();
464-
num >= 400 && num < 500
464+
(400..500).contains(&num)
465465
}
466466

467467
/// Returns `true` if the status code is the `5xx` range.
@@ -470,7 +470,7 @@ impl StatusCode {
470470
/// apparently valid request.
471471
pub fn is_server_error(&self) -> bool {
472472
let num: u16 = self.clone().into();
473-
num >= 500 && num < 600
473+
(500..600).contains(&num)
474474
}
475475

476476
/// The canonical reason for a given status code

0 commit comments

Comments
 (0)