From 345fa645032de767f5b2bfed9136433e62470613 Mon Sep 17 00:00:00 2001 From: Eduardo Trujillo <ed@chromabits.com> Date: Tue, 15 Nov 2022 10:02:49 -0800 Subject: [PATCH] style: Run cargo fmt --- src/bundle/s3/poller.rs | 12 +++++------- src/files/mod.rs | 2 +- src/files/path_context.rs | 2 +- src/files/service.rs | 9 ++++++--- src/main.rs | 7 +++++-- src/server.rs | 2 +- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/bundle/s3/poller.rs b/src/bundle/s3/poller.rs index 4dc5523..23aef08 100644 --- a/src/bundle/s3/poller.rs +++ b/src/bundle/s3/poller.rs @@ -9,8 +9,8 @@ use rusoto_s3::{ GetObjectError, GetObjectRequest, HeadObjectError, HeadObjectRequest, S3Client, S3, }; use snafu::{ResultExt, Snafu}; -use tokio_tar::Archive; use std::path::PathBuf; +use tokio_tar::Archive; #[derive(Snafu, Debug)] pub enum InternalError { @@ -148,14 +148,12 @@ impl BundlePoller for S3BundlePoller { info!("S3BundlePoller: Unpacking bundle..."); let stream = get_object_response - .body - .ok_or(InternalError::S3MissingBody)? - .into_async_read(); + .body + .ok_or(InternalError::S3MissingBody)? + .into_async_read(); // TODO: Write temp file to disk. - let mut archive = Archive::new( - stream - ); + let mut archive = Archive::new(stream); archive .unpack(path) diff --git a/src/files/mod.rs b/src/files/mod.rs index 9eb8f71..a91534f 100644 --- a/src/files/mod.rs +++ b/src/files/mod.rs @@ -4,7 +4,7 @@ use std::cell::RefCell; use std::path::PathBuf; use std::rc::Rc; -use std::sync::{Arc}; +use std::sync::Arc; use actix_service::boxed::{self, BoxServiceFactory}; use actix_service::{IntoServiceFactory, ServiceFactory, ServiceFactoryExt}; diff --git a/src/files/path_context.rs b/src/files/path_context.rs index 3e22268..36f5a81 100644 --- a/src/files/path_context.rs +++ b/src/files/path_context.rs @@ -1,6 +1,6 @@ use super::directory::index::IndexStrategy; use crate::config::{ContentDispositionConfig, PathConfig, PathMatcherConfig, ServerConfig}; -use actix_web::http::header::{DispositionType, HeaderMap, self}; +use actix_web::http::header::{self, DispositionType, HeaderMap}; use regex::Regex; use snafu::{ResultExt, Snafu}; use std::{ diff --git a/src/files/service.rs b/src/files/service.rs index 8700c5c..0bab998 100644 --- a/src/files/service.rs +++ b/src/files/service.rs @@ -20,16 +20,16 @@ use async_recursion::async_recursion; use futures_util::future::LocalBoxFuture; use snafu::ResultExt; use snafu::Snafu; -use tokio::sync::RwLock; use std::{ convert::TryInto, io, ops::Deref, path::{Path, PathBuf}, rc::Rc, - sync::{Arc}, + sync::Arc, task::{Context, Poll}, }; +use tokio::sync::RwLock; /// Errors which can occur when serving static files. #[derive(Snafu, Debug)] @@ -164,7 +164,10 @@ impl FilesServiceInner { } } - async fn get_request_context_for_request(&self, req: &ServiceRequest) -> Result<RequestContext, Error> { + async fn get_request_context_for_request( + &self, + req: &ServiceRequest, + ) -> Result<RequestContext, Error> { let serve_dir = self.get_serve_dir().await?; let path_from_request: UriPathBuf = req.try_into().context(BuildUriPath)?; diff --git a/src/main.rs b/src/main.rs index a9b2c1e..c707a38 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,19 +5,22 @@ extern crate log; use actix::prelude::*; use clap::{Parser, Subcommand}; -use collective::{cli::{AppOpts, ConfigurableAppOpts}, config::ConfigFileFormat}; +use collective::{ + cli::{AppOpts, ConfigurableAppOpts}, + config::ConfigFileFormat, +}; use lazy_static::lazy_static; use monitor::Monitor; use server::Server; use snafu::{ResultExt, Snafu}; use stats::StatsServer; -use tokio::sync::RwLock; use std::{ collections::HashSet, net::SocketAddr, path::PathBuf, sync::{mpsc, Arc}, }; +use tokio::sync::RwLock; pub mod bundle; pub mod config; diff --git a/src/server.rs b/src/server.rs index 331fbcd..dfcbdbf 100644 --- a/src/server.rs +++ b/src/server.rs @@ -12,7 +12,6 @@ use actix_web::{ App, HttpServer, }; use snafu::{ResultExt, Snafu}; -use tokio::sync::RwLock; use std::{ convert::{TryFrom, TryInto}, path::PathBuf, @@ -22,6 +21,7 @@ use std::{ }, thread::{JoinHandle, Thread}, }; +use tokio::sync::RwLock; #[derive(Debug, Snafu)] pub enum Error { -- GitLab