Skip to content

Commit 119684b

Browse files
committed
refactor(http1): simplify match of Token parse error
1 parent 2968dbc commit 119684b

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/proto/h1/role.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,16 @@ impl Http1Transaction for Server {
188188
headers_len = req.headers.len();
189189
}
190190
Ok(httparse::Status::Partial) => return Ok(None),
191-
Err(err) => {
192-
return Err(match err {
193-
// if invalid Token, try to determine if for method or path
194-
httparse::Error::Token => {
195-
if req.method.is_none() {
196-
Parse::Method
197-
} else {
198-
debug_assert!(req.path.is_none());
199-
Parse::Uri
200-
}
201-
}
202-
other => other.into(),
203-
});
204-
}
191+
// if invalid Token, try to determine if for method or path
192+
Err(httparse::Error::Token) => return Err({
193+
if req.method.is_none() {
194+
Parse::Method
195+
} else {
196+
debug_assert!(req.path.is_none());
197+
Parse::Uri
198+
}
199+
}),
200+
Err(err) => return Err(err.into()),
205201
}
206202
};
207203

0 commit comments

Comments
 (0)