From a93e33092658cd9439205ec5bd6d75c3ad7d3ba4 Mon Sep 17 00:00:00 2001 From: "deepsource-dev-autofix[bot]" <61578317+deepsource-dev-autofix[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 09:44:49 +0000 Subject: [PATCH] style: format code with rustfmt Format code with rustfmt This commit fixes the style issues introduced in f80fb09 according to the output from Rustfmt. Details: None --- demo_format.rs | 25 +++++++++---------------- src/main.rs | 3 ++- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/demo_format.rs b/demo_format.rs index 1ed8dbf..f1bc269 100644 --- a/demo_format.rs +++ b/demo_format.rs @@ -1,9 +1,7 @@ use actix_files::Files; use actix_multipart::Multipart; use actix_web::{ - get, middleware::Logger, -post, web, -App, Error, HttpResponse, HttpServer, Responder, + get, middleware::Logger, post, web, App, Error, HttpResponse, HttpServer, Responder, }; use futures_util::stream::StreamExt as _; @@ -19,15 +17,12 @@ use std::os::windows::fs::MetadataExt; #[get("/{route}")] async fn index_routes() -> impl Responder { - HttpResponse::Ok() - .body(read("./build/index.html") - .unwrap()) + HttpResponse::Ok().body(read("./build/index.html").unwrap()) } #[get("/")] async fn index() -> impl Responder { - HttpResponse::Ok() - .body(read("./build/index.html").unwrap()) + HttpResponse::Ok().body(read("./build/index.html").unwrap()) } #[post("/upload/")] @@ -35,7 +30,7 @@ async fn upload(mut payload: Multipart) -> Result { // iterate over multipart stream log::warn!("/upload/ was called!"); while let Some(Ok(mut field)) = payload.next().await { - // A multipart/form-data stream has to contain `content_disposition` + // A multipart/form-data stream has to contain `content_disposition` let content_disposition = field.content_disposition(); let filename = content_disposition .get_filename() @@ -47,8 +42,8 @@ async fn upload(mut payload: Multipart) -> Result { // Field in turn is stream of *Bytes* object while let Some(Ok(chunk)) = field.next().await { - // filesystem operations are blocking, we have to use threadpool - f = web::block(move || f.write_all(&chunk).map(|_| f)).await??; + // filesystem operations are blocking, we have to use threadpool + f = web::block(move || f.write_all(&chunk).map(|_| f)).await??; } } @@ -95,7 +90,6 @@ async fn main() -> std::io::Result<()> { .await } - use cookie::{Cookie, CookieJar}; fn use_cookie_without_secure() { @@ -116,14 +110,13 @@ fn use_cookie_without_http_only() { } fn use_cookie_builder_without_http_only() { - Cookie::build("name", - "value").http_only(true); + Cookie::build("name", "value").http_only(true); Cookie::build("name", "value").http_only(false); } fn header() { -use http::header::{HeaderMap, SERVER, SET_COOKIE}; -let mut h = HeaderMap::new(); + use http::header::{HeaderMap, SERVER, SET_COOKIE}; + let mut h = HeaderMap::new(); h.insert(SERVER, 5.into()); h.insert(SET_COOKIE, 42.into()); } diff --git a/src/main.rs b/src/main.rs index 454e2ba..c0c6714 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,8 @@ fn main() { if false { // this is untouched comment, this is untouched comment // this is untouched comment - } print!("main"); + } + print!("main"); bar(); }