clippy says: use char (',') instead of string (",")

https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
This commit is contained in:
Simon B 2019-01-20 19:14:36 +01:00
parent dda8497d54
commit 8935f3c7b4
3 changed files with 8 additions and 8 deletions

View file

@ -68,7 +68,7 @@ impl HeaderHandler {
impl Handler for HeaderHandler { impl Handler for HeaderHandler {
fn get(&self, req: Request<Body>) -> ResponseFuture { 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"), None => return response(StatusCode::BAD_REQUEST, "invalid url"),
Some(el) => el, Some(el) => el,
}; };
@ -125,12 +125,12 @@ fn check_block_param(input: &String) -> Result<(), Error> {
"Not a valid hash or height.".to_owned(), "Not a valid hash or height.".to_owned(),
))?; ))?;
} }
return Ok(()); Ok(())
} }
impl Handler for BlockHandler { impl Handler for BlockHandler {
fn get(&self, req: Request<Body>) -> ResponseFuture { 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"), None => return response(StatusCode::BAD_REQUEST, "invalid url"),
Some(el) => el, Some(el) => el,
}; };

View file

@ -111,7 +111,7 @@ impl OutputHandler {
for (k, id) in params { for (k, id) in params {
if k == "id" { if k == "id" {
for id in id.split(",") { for id in id.split(',') {
commitments.push(id.to_owned()); commitments.push(id.to_owned());
} }
} }
@ -178,7 +178,7 @@ impl OutputHandler {
if let Some(ids) = params.get("id") { if let Some(ids) = params.get("id") {
for id in ids { for id in ids {
for id in id.split(",") { for id in id.split(',') {
if let Ok(x) = util::from_hex(String::from(id)) { if let Ok(x) = util::from_hex(String::from(id)) {
commitments.push(Commitment::from_vec(x)); commitments.push(Commitment::from_vec(x));
} }
@ -223,7 +223,7 @@ impl OutputHandler {
impl Handler for OutputHandler { impl Handler for OutputHandler {
fn get(&self, req: Request<Body>) -> ResponseFuture { 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, Some(c) => c,
None => return response(StatusCode::BAD_REQUEST, "invalid url"), None => return response(StatusCode::BAD_REQUEST, "invalid url"),
}; };

View file

@ -56,7 +56,7 @@ pub struct PeerHandler {
impl Handler for PeerHandler { impl Handler for PeerHandler {
fn get(&self, req: Request<Body>) -> ResponseFuture { 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, Some(c) => c,
None => return response(StatusCode::BAD_REQUEST, "invalid url"), None => return response(StatusCode::BAD_REQUEST, "invalid url"),
}; };
@ -73,7 +73,7 @@ impl Handler for PeerHandler {
} }
} }
fn post(&self, req: Request<Body>) -> ResponseFuture { 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() { let command = match path_elems.next() {
None => return response(StatusCode::BAD_REQUEST, "invalid url"), None => return response(StatusCode::BAD_REQUEST, "invalid url"),
Some(c) => c, Some(c) => c,