From 8935f3c7b46823b4c211167c14dbead5080628f9 Mon Sep 17 00:00:00 2001 From: Simon B <simon.bohlin@gmail.com> Date: Sun, 20 Jan 2019 19:14:36 +0100 Subject: [PATCH] clippy says: use char (',') instead of string (",") https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern --- api/src/handlers/blocks_api.rs | 6 +++--- api/src/handlers/chain_api.rs | 6 +++--- api/src/handlers/peers_api.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/src/handlers/blocks_api.rs b/api/src/handlers/blocks_api.rs index aabb29fb5..935bf5af6 100644 --- a/api/src/handlers/blocks_api.rs +++ b/api/src/handlers/blocks_api.rs @@ -68,7 +68,7 @@ impl HeaderHandler { impl Handler for HeaderHandler { fn get(&self, req: Request<Body>) -> ResponseFuture { - let el = match req.uri().path().trim_right_matches("/").rsplit("/").next() { + let el = match req.uri().path().trim_right_matches('/').rsplit('/').next() { None => return response(StatusCode::BAD_REQUEST, "invalid url"), Some(el) => el, }; @@ -125,12 +125,12 @@ fn check_block_param(input: &String) -> Result<(), Error> { "Not a valid hash or height.".to_owned(), ))?; } - return Ok(()); + Ok(()) } impl Handler for BlockHandler { fn get(&self, req: Request<Body>) -> ResponseFuture { - let el = match req.uri().path().trim_right_matches("/").rsplit("/").next() { + let el = match req.uri().path().trim_right_matches('/').rsplit('/').next() { None => return response(StatusCode::BAD_REQUEST, "invalid url"), Some(el) => el, }; diff --git a/api/src/handlers/chain_api.rs b/api/src/handlers/chain_api.rs index 150de6821..910838671 100644 --- a/api/src/handlers/chain_api.rs +++ b/api/src/handlers/chain_api.rs @@ -111,7 +111,7 @@ impl OutputHandler { for (k, id) in params { if k == "id" { - for id in id.split(",") { + for id in id.split(',') { commitments.push(id.to_owned()); } } @@ -178,7 +178,7 @@ impl OutputHandler { if let Some(ids) = params.get("id") { for id in ids { - for id in id.split(",") { + for id in id.split(',') { if let Ok(x) = util::from_hex(String::from(id)) { commitments.push(Commitment::from_vec(x)); } @@ -223,7 +223,7 @@ impl OutputHandler { impl Handler for OutputHandler { fn get(&self, req: Request<Body>) -> ResponseFuture { - let command = match req.uri().path().trim_right_matches("/").rsplit("/").next() { + let command = match req.uri().path().trim_right_matches('/').rsplit('/').next() { Some(c) => c, None => return response(StatusCode::BAD_REQUEST, "invalid url"), }; diff --git a/api/src/handlers/peers_api.rs b/api/src/handlers/peers_api.rs index c700b54b1..2dd7be113 100644 --- a/api/src/handlers/peers_api.rs +++ b/api/src/handlers/peers_api.rs @@ -56,7 +56,7 @@ pub struct PeerHandler { impl Handler for PeerHandler { fn get(&self, req: Request<Body>) -> ResponseFuture { - let command = match req.uri().path().trim_right_matches("/").rsplit("/").next() { + let command = match req.uri().path().trim_right_matches('/').rsplit('/').next() { Some(c) => c, None => return response(StatusCode::BAD_REQUEST, "invalid url"), }; @@ -73,7 +73,7 @@ impl Handler for PeerHandler { } } fn post(&self, req: Request<Body>) -> ResponseFuture { - let mut path_elems = req.uri().path().trim_right_matches("/").rsplit("/"); + let mut path_elems = req.uri().path().trim_right_matches('/').rsplit('/'); let command = match path_elems.next() { None => return response(StatusCode::BAD_REQUEST, "invalid url"), Some(c) => c,