Skip to content

Commit 3a4d187

Browse files
committed
satisfy new clippy: "match expression looks like matches! macro"
1 parent c986d57 commit 3a4d187

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

src/method.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ impl Method {
4343
///
4444
/// See [the spec](https://tools.ietf.org/html/rfc7231#section-4.2.1) for more details.
4545
pub fn is_safe(&self) -> bool {
46-
match self {
47-
Method::Get | Method::Head | Method::Options | Method::Trace => true,
48-
_ => false,
49-
}
46+
matches!(
47+
self,
48+
Method::Get | Method::Head | Method::Options | Method::Trace
49+
)
5050
}
5151
}
5252

src/mime/parse.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub(crate) fn parse(input: &str) -> crate::Result<Mime> {
119119

120120
/// Validates [HTTP token code points](https://mimesniff.spec.whatwg.org/#http-token-code-point)
121121
fn is_http_token_code_point(c: char) -> bool {
122-
match c {
122+
matches!(c,
123123
'!'
124124
| '#'
125125
| '$'
@@ -137,25 +137,17 @@ fn is_http_token_code_point(c: char) -> bool {
137137
| '~'
138138
| 'a'..='z'
139139
| 'A'..='Z'
140-
| '0'..='9' => true,
141-
_ => false,
142-
}
140+
| '0'..='9')
143141
}
144142

145143
/// Validates [HTTP quoted-string token code points](https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point)
146144
fn is_http_quoted_string_token_code_point(c: char) -> bool {
147-
match c {
148-
'\t' | ' '..='~' | '\u{80}'..='\u{FF}' => true,
149-
_ => false,
150-
}
145+
matches!(c, '\t' | ' '..='~' | '\u{80}'..='\u{FF}')
151146
}
152147

153148
/// Is a [HTTP whitespace](https://fetch.spec.whatwg.org/#http-whitespace)
154149
fn is_http_whitespace_char(c: char) -> bool {
155-
match c {
156-
'\n' | '\r' | '\t' | ' ' => true,
157-
_ => false,
158-
}
150+
matches!(c, '\n' | '\r' | '\t' | ' ')
159151
}
160152

161153
/// [code point sequence collection](https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points)

0 commit comments

Comments
 (0)