From 5401bcc2689ed7f2ecfd7438d53779ceb31c38df Mon Sep 17 00:00:00 2001 From: rasul Date: Sat, 1 Feb 2020 15:25:28 -0600 Subject: [PATCH] rustfmt --- src/paste.rs | 6 ++++-- src/routes/raw.rs | 11 +++-------- src/routes/submit.rs | 12 +++--------- src/syntax.rs | 2 +- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/paste.rs b/src/paste.rs index 5fde797..e46d8c4 100644 --- a/src/paste.rs +++ b/src/paste.rs @@ -43,11 +43,13 @@ impl Paste { lang: "Plain Text".into(), }) } else { - Err(Box::new(Error::new(ErrorKind::Other, "couldn't generate hash"))) + Err(Box::new(Error::new( + ErrorKind::Other, + "couldn't generate hash", + ))) } } - pub fn from_form(form: HashMap, salt: String) -> Result { let dt = Utc::now(); let harsh = HarshBuilder::new().salt(salt).init()?; diff --git a/src/routes/raw.rs b/src/routes/raw.rs index 317d1a5..7ed3516 100644 --- a/src/routes/raw.rs +++ b/src/routes/raw.rs @@ -27,19 +27,14 @@ pub fn get(mut state: State) -> Box { match Paste::from_file(path) { Ok(paste) => { - let res = create_response( - &state, - StatusCode::OK, - mime::TEXT_PLAIN, - paste.text, - ); + let res = create_response(&state, StatusCode::OK, mime::TEXT_PLAIN, paste.text); future::ok((state, res)) - }, + } Err(e) => { let io_error = std::io::Error::new(std::io::ErrorKind::Other, e.description()); future::err((state, io_error.into_handler_error())) - }, + } } }) } diff --git a/src/routes/submit.rs b/src/routes/submit.rs index e357d63..26a2170 100644 --- a/src/routes/submit.rs +++ b/src/routes/submit.rs @@ -43,20 +43,19 @@ pub fn put(mut state: State) -> Box { future::ok((state, res)) } - }, + } Err(e) => { let err = Error::new(ErrorKind::Other, e.description()); future::err((state, err.into_handler_error())) } } - }, + } Err(e) => future::err((state, e.into_handler_error())), } }) }) } - pub fn post(mut state: State) -> Box { Box::new({ Body::take_from(&mut state).concat2().then(|body| { @@ -86,12 +85,7 @@ pub fn post(mut state: State) -> Box { future::ok((state, res)) } else { - let res = create_response( - &state, - StatusCode::OK, - mime::TEXT_PLAIN, - "ERR" - ); + let res = create_response(&state, StatusCode::OK, mime::TEXT_PLAIN, "ERR"); future::ok((state, res)) } diff --git a/src/syntax.rs b/src/syntax.rs index 04cdb40..e1c1856 100644 --- a/src/syntax.rs +++ b/src/syntax.rs @@ -8,7 +8,7 @@ lazy_static! { let mut syntaxes: Vec = Vec::new(); for syntax in syntax_set.syntaxes() { - if ! syntax.hidden { + if !syntax.hidden { syntaxes.push(syntax.name.clone()); } }