From 4beaacb6f4278394347eda02a17feaac37914591 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 7 Nov 2018 13:58:09 +0100 Subject: [PATCH] code cleanup --- src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9aed6d19..234fa58b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,7 +59,7 @@ fn handle_request(req: Request) -> Response { _ => http_error!(NOT_FOUND, format!("No such method '{} {}'\n", method, path)), }; - // handle auth + // fixme: handle auth // extract param let param = match query { @@ -67,10 +67,9 @@ fn handle_request(req: Request) -> Response { match parse_query_string(data, &api_method.parameters, true) { Ok(query) => query, Err(ref error_list) => { - let mut msg = String::from(""); - for item in error_list { - msg = msg + &item.to_string() + "\n"; - } + let msg = error_list.iter().fold(String::from(""), |acc, item| { + acc + &item.to_string() + "\n" + }); http_error!(BAD_REQUEST, msg); } }