File tree Expand file tree Collapse file tree 2 files changed +8
-16
lines changed Expand file tree Collapse file tree 2 files changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -43,10 +43,10 @@ impl Method {
43
43
///
44
44
/// See [the spec](https://tools.ietf.org/html/rfc7231#section-4.2.1) for more details.
45
45
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
+ )
50
50
}
51
51
}
52
52
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ pub(crate) fn parse(input: &str) -> crate::Result<Mime> {
119
119
120
120
/// Validates [HTTP token code points](https://mimesniff.spec.whatwg.org/#http-token-code-point)
121
121
fn is_http_token_code_point ( c : char ) -> bool {
122
- match c {
122
+ matches ! ( c ,
123
123
'!'
124
124
| '#'
125
125
| '$'
@@ -137,25 +137,17 @@ fn is_http_token_code_point(c: char) -> bool {
137
137
| '~'
138
138
| 'a' ..='z'
139
139
| 'A' ..='Z'
140
- | '0' ..='9' => true ,
141
- _ => false ,
142
- }
140
+ | '0' ..='9' )
143
141
}
144
142
145
143
/// Validates [HTTP quoted-string token code points](https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point)
146
144
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}' )
151
146
}
152
147
153
148
/// Is a [HTTP whitespace](https://fetch.spec.whatwg.org/#http-whitespace)
154
149
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' | ' ' )
159
151
}
160
152
161
153
/// [code point sequence collection](https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points)
You can’t perform that action at this time.
0 commit comments