1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-01-18 05:41:50 +01:00

code cleanup

This commit is contained in:
Nikolay Kim 2017-12-02 12:14:16 -08:00
parent d0b9d9c1d6
commit 29a26b3236
2 changed files with 4 additions and 7 deletions

View File

@ -244,9 +244,8 @@ impl<S> ApplicationBuilder<S> where S: 'static {
routes.push((path, handler)) routes.push((path, handler))
} }
for (path, mut handler) in parts.handlers { for (path, handler) in parts.handlers {
let path = prefix.clone() + path.trim_left_matches('/'); handlers.insert(prefix.clone() + path.trim_left_matches('/'), handler);
handlers.insert(path, handler);
} }
Application { Application {
state: Rc::new(parts.state), state: Rc::new(parts.state),

View File

@ -168,10 +168,8 @@ impl From<FromUtf8Error> for ParseError {
impl From<httparse::Error> for ParseError { impl From<httparse::Error> for ParseError {
fn from(err: httparse::Error) -> ParseError { fn from(err: httparse::Error) -> ParseError {
match err { match err {
httparse::Error::HeaderName | httparse::Error::HeaderName | httparse::Error::HeaderValue |
httparse::Error::HeaderValue | httparse::Error::NewLine | httparse::Error::Token => ParseError::Header,
httparse::Error::NewLine |
httparse::Error::Token => ParseError::Header,
httparse::Error::Status => ParseError::Status, httparse::Error::Status => ParseError::Status,
httparse::Error::TooManyHeaders => ParseError::TooLarge, httparse::Error::TooManyHeaders => ParseError::TooLarge,
httparse::Error::Version => ParseError::Version, httparse::Error::Version => ParseError::Version,