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 {
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
Original file line number Diff line number Diff 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)
121121fn 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)
146144fn 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)
154149fn 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)
You can’t perform that action at this time.
0 commit comments