From 29a26b3236306cae73e8f229f49f80289a78c4c7 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sat, 2 Dec 2017 12:14:16 -0800 Subject: [PATCH] code cleanup --- src/application.rs | 5 ++--- src/error.rs | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) 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,