diff --git a/src/application.rs b/src/application.rs index 4fe5f1dd8..e890787cb 100644 --- a/src/application.rs +++ b/src/application.rs @@ -244,9 +244,8 @@ impl ApplicationBuilder where S: 'static { routes.push((path, handler)) } - for (path, mut handler) in parts.handlers { - let path = prefix.clone() + path.trim_left_matches('/'); - handlers.insert(path, handler); + for (path, handler) in parts.handlers { + handlers.insert(prefix.clone() + path.trim_left_matches('/'), handler); } Application { state: Rc::new(parts.state), diff --git a/src/error.rs b/src/error.rs index f9b1fca07..0f03bcdd4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -168,10 +168,8 @@ impl From for ParseError { impl From for ParseError { fn from(err: httparse::Error) -> ParseError { match err { - httparse::Error::HeaderName | - httparse::Error::HeaderValue | - httparse::Error::NewLine | - httparse::Error::Token => ParseError::Header, + httparse::Error::HeaderName | httparse::Error::HeaderValue | + httparse::Error::NewLine | httparse::Error::Token => ParseError::Header, httparse::Error::Status => ParseError::Status, httparse::Error::TooManyHeaders => ParseError::TooLarge, httparse::Error::Version => ParseError::Version,