From bf4fdec25fafef193dbed327aaf3d19035fc8e4b Mon Sep 17 00:00:00 2001 From: Pavel Kirilin Date: Sun, 6 Mar 2022 22:33:00 +0400 Subject: [PATCH] Updated rustfmt config. (#53) Signed-off-by: Pavel Kirilin --- .github/workflows/test.yml | 2 +- .pre-commit-config.yaml | 3 ++ src/config.rs | 11 +++---- src/errors.rs | 3 +- src/info_storages/db_info_storage.rs | 15 ++++------ src/info_storages/file_info_storage.rs | 29 +++++++++++------- src/info_storages/mod.rs | 6 ++-- .../models/available_info_storages.rs | 3 +- src/info_storages/models/file_info.rs | 6 ++-- src/info_storages/models/info_store.rs | 3 +- src/info_storages/redis_info_storage.rs | 16 +++++----- src/main.rs | 20 ++++++------- src/notifiers/amqp_notifier.rs | 17 ++++++----- src/notifiers/dir_notifier.rs | 14 +++++---- src/notifiers/file_notifier.rs | 14 +++++---- src/notifiers/http_notifier.rs | 6 ++-- src/notifiers/mod.rs | 4 +-- src/notifiers/models/message_format.rs | 6 ++-- src/notifiers/models/notification_manager.rs | 10 +++---- src/protocol/core/get_info.rs | 6 ++-- src/protocol/core/server_info.rs | 6 ++-- src/protocol/core/write_bytes.rs | 20 ++++++++----- src/protocol/creation/routes.rs | 26 ++++++++-------- src/protocol/getting/routes.rs | 11 +++---- src/protocol/termination/routes.rs | 16 ++++++---- src/server.rs | 3 +- src/storages/file_storage.rs | 30 +++++++++++-------- src/storages/mod.rs | 3 +- src/storages/models/available_stores.rs | 3 +- src/storages/models/storage.rs | 3 +- src/utils/dir_struct.rs | 3 +- 31 files changed, 166 insertions(+), 152 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 300c468..1e12134 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: - name: Adding component run: rustup component add rustfmt - name: Checking code format - run: cargo fmt -- --check + run: cargo fmt -- --check --config use_try_shorthand=true,imports_granularity=Crate code_check: needs: pre_job diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ffc5f67..64c437a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,9 @@ repos: pass_filenames: false args: - fmt + - -- + - --config + - use_try_shorthand=true,imports_granularity=Crate - id: clippy types: diff --git a/src/config.rs b/src/config.rs index 78dbc02..50b8b79 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,11 +1,12 @@ -use std::ffi::OsString; -use std::path::PathBuf; +use std::{ffi::OsString, path::PathBuf}; use structopt::StructOpt; -use crate::info_storages::AvailableInfoStores; -use crate::notifiers::{Format, Hook}; -use crate::protocol::extensions::Extensions; +use crate::{ + info_storages::AvailableInfoStores, + notifiers::{Format, Hook}, + protocol::extensions::Extensions, +}; use crate::storages::AvailableStores; diff --git a/src/errors.rs b/src/errors.rs index 99eaec5..c2a4f49 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,7 +1,6 @@ use std::io::{Error, ErrorKind}; -use actix_web::http::StatusCode; -use actix_web::{HttpResponse, HttpResponseBuilder, ResponseError}; +use actix_web::{http::StatusCode, HttpResponse, HttpResponseBuilder, ResponseError}; use log::error; pub type RustusResult = Result; diff --git a/src/info_storages/db_info_storage.rs b/src/info_storages/db_info_storage.rs index baa0092..74901bf 100644 --- a/src/info_storages/db_info_storage.rs +++ b/src/info_storages/db_info_storage.rs @@ -1,14 +1,12 @@ use std::time::Duration; use async_trait::async_trait; -use rbatis::crud::CRUD; -use rbatis::crud_table; -use rbatis::db::DBPoolOptions; -use rbatis::executor::Executor; -use rbatis::rbatis::Rbatis; +use rbatis::{crud::CRUD, crud_table, db::DBPoolOptions, executor::Executor, rbatis::Rbatis}; -use crate::errors::{RustusError, RustusResult}; -use crate::info_storages::{FileInfo, InfoStorage}; +use crate::{ + errors::{RustusError, RustusResult}, + info_storages::{FileInfo, InfoStorage}, +}; #[crud_table] struct DbModel { @@ -84,8 +82,7 @@ impl InfoStorage for DBInfoStorage { #[cfg(test)] mod tests { use super::{DBInfoStorage, DbModel}; - use crate::info_storages::FileInfo; - use crate::InfoStorage; + use crate::{info_storages::FileInfo, InfoStorage}; use rbatis::crud::CRUD; async fn get_info_storage() -> DBInfoStorage { diff --git a/src/info_storages/file_info_storage.rs b/src/info_storages/file_info_storage.rs index 309b47a..a2cdf35 100644 --- a/src/info_storages/file_info_storage.rs +++ b/src/info_storages/file_info_storage.rs @@ -1,14 +1,20 @@ -use std::io::{Read, Write}; -use std::path::PathBuf; +use std::{ + io::{Read, Write}, + path::PathBuf, +}; use async_trait::async_trait; use log::error; -use std::fs::{remove_file, File, OpenOptions}; -use std::io::{BufReader, BufWriter}; +use std::{ + fs::{remove_file, File, OpenOptions}, + io::{BufReader, BufWriter}, +}; use tokio::fs::DirBuilder; -use crate::errors::{RustusError, RustusResult}; -use crate::info_storages::{FileInfo, InfoStorage}; +use crate::{ + errors::{RustusError, RustusResult}, + info_storages::{FileInfo, InfoStorage}, +}; pub struct FileInfoStorage { info_dir: PathBuf, @@ -94,11 +100,12 @@ impl InfoStorage for FileInfoStorage { #[cfg(test)] mod tests { use super::FileInfoStorage; - use crate::info_storages::FileInfo; - use crate::InfoStorage; - use std::collections::HashMap; - use std::fs::File; - use std::io::{Read, Write}; + use crate::{info_storages::FileInfo, InfoStorage}; + use std::{ + collections::HashMap, + fs::File, + io::{Read, Write}, + }; #[actix_rt::test] async fn preparation() { diff --git a/src/info_storages/mod.rs b/src/info_storages/mod.rs index 66338b6..fe5d56d 100644 --- a/src/info_storages/mod.rs +++ b/src/info_storages/mod.rs @@ -7,6 +7,6 @@ pub mod redis_info_storage; pub mod models; -pub use models::available_info_storages::AvailableInfoStores; -pub use models::file_info::FileInfo; -pub use models::info_store::InfoStorage; +pub use models::{ + available_info_storages::AvailableInfoStores, file_info::FileInfo, info_store::InfoStorage, +}; diff --git a/src/info_storages/models/available_info_storages.rs b/src/info_storages/models/available_info_storages.rs index e5e481f..698190a 100644 --- a/src/info_storages/models/available_info_storages.rs +++ b/src/info_storages/models/available_info_storages.rs @@ -1,7 +1,6 @@ use derive_more::{Display, From}; -use crate::errors::RustusResult; -use crate::{from_str, RustusConf}; +use crate::{errors::RustusResult, from_str, RustusConf}; use crate::info_storages::{file_info_storage, InfoStorage}; use strum::EnumIter; diff --git a/src/info_storages/models/file_info.rs b/src/info_storages/models/file_info.rs index 806ef3e..42089ab 100644 --- a/src/info_storages/models/file_info.rs +++ b/src/info_storages/models/file_info.rs @@ -1,9 +1,7 @@ use std::collections::HashMap; -use crate::errors::RustusError; -use crate::RustusResult; -use chrono::serde::ts_seconds; -use chrono::{DateTime, Utc}; +use crate::{errors::RustusError, RustusResult}; +use chrono::{serde::ts_seconds, DateTime, Utc}; use log::error; use serde::{Deserialize, Serialize}; diff --git a/src/info_storages/models/info_store.rs b/src/info_storages/models/info_store.rs index 66418e0..ec5ffe6 100644 --- a/src/info_storages/models/info_store.rs +++ b/src/info_storages/models/info_store.rs @@ -1,5 +1,4 @@ -use crate::errors::RustusResult; -use crate::info_storages::FileInfo; +use crate::{errors::RustusResult, info_storages::FileInfo}; use async_trait::async_trait; /// Trait for every info storage. diff --git a/src/info_storages/redis_info_storage.rs b/src/info_storages/redis_info_storage.rs index 01bde22..07adebe 100644 --- a/src/info_storages/redis_info_storage.rs +++ b/src/info_storages/redis_info_storage.rs @@ -1,11 +1,11 @@ use async_trait::async_trait; -use mobc_redis::mobc::Pool; -use mobc_redis::redis; -use mobc_redis::RedisConnectionManager; +use mobc_redis::{mobc::Pool, redis, RedisConnectionManager}; use redis::aio::Connection; -use crate::errors::{RustusError, RustusResult}; -use crate::info_storages::{FileInfo, InfoStorage}; +use crate::{ + errors::{RustusError, RustusResult}, + info_storages::{FileInfo, InfoStorage}, +}; pub struct RedisStorage { pool: Pool, @@ -66,10 +66,8 @@ impl InfoStorage for RedisStorage { #[cfg(feature = "test_redis")] mod tests { use super::RedisStorage; - use crate::info_storages::FileInfo; - use crate::InfoStorage; - use mobc_redis::redis; - use mobc_redis::redis::AsyncCommands; + use crate::{info_storages::FileInfo, InfoStorage}; + use mobc_redis::{redis, redis::AsyncCommands}; async fn get_storage() -> RedisStorage { let redis_url = std::env::var("TEST_REDIS_URL").unwrap(); diff --git a/src/main.rs b/src/main.rs index 99c82d3..400db9f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,25 +1,25 @@ #![cfg_attr(coverage, feature(no_coverage))] -use std::str::FromStr; -use std::sync::Arc; +use std::{str::FromStr, sync::Arc}; use actix_web::{ dev::{Server, Service}, http::Method, middleware, web, App, HttpServer, }; -use fern::colors::{Color, ColoredLevelConfig}; -use fern::Dispatch; +use fern::{ + colors::{Color, ColoredLevelConfig}, + Dispatch, +}; use log::LevelFilter; use config::RustusConf; -use crate::errors::RustusResult; -use crate::info_storages::InfoStorage; -use crate::notifiers::models::notification_manager::NotificationManager; -use crate::server::rustus_service; -use crate::state::State; -use crate::storages::Storage; +use crate::{ + errors::RustusResult, info_storages::InfoStorage, + notifiers::models::notification_manager::NotificationManager, server::rustus_service, + state::State, storages::Storage, +}; mod config; mod errors; diff --git a/src/notifiers/amqp_notifier.rs b/src/notifiers/amqp_notifier.rs index a7088f9..8810a3f 100644 --- a/src/notifiers/amqp_notifier.rs +++ b/src/notifiers/amqp_notifier.rs @@ -1,14 +1,15 @@ -use crate::notifiers::{Hook, Notifier}; -use crate::RustusResult; +use crate::{ + notifiers::{Hook, Notifier}, + RustusResult, +}; use actix_web::http::header::HeaderMap; use async_trait::async_trait; -use lapin::options::{ - BasicPublishOptions, ExchangeDeclareOptions, QueueBindOptions, QueueDeclareOptions, +use lapin::{ + options::{BasicPublishOptions, ExchangeDeclareOptions, QueueBindOptions, QueueDeclareOptions}, + types::FieldTable, + BasicProperties, ConnectionProperties, ExchangeKind, }; -use lapin::types::FieldTable; -use lapin::{BasicProperties, ConnectionProperties, ExchangeKind}; -use mobc_lapin::mobc::Pool; -use mobc_lapin::RMQConnectionManager; +use mobc_lapin::{mobc::Pool, RMQConnectionManager}; use strum::IntoEnumIterator; use tokio_amqp::LapinTokioExt; diff --git a/src/notifiers/dir_notifier.rs b/src/notifiers/dir_notifier.rs index 73b0b9a..303b21b 100644 --- a/src/notifiers/dir_notifier.rs +++ b/src/notifiers/dir_notifier.rs @@ -1,6 +1,8 @@ -use crate::errors::RustusError; -use crate::notifiers::{Hook, Notifier}; -use crate::RustusResult; +use crate::{ + errors::RustusError, + notifiers::{Hook, Notifier}, + RustusResult, +}; use actix_web::http::header::HeaderMap; use async_trait::async_trait; use log::debug; @@ -53,10 +55,12 @@ mod tests { use super::DirNotifier; use crate::notifiers::{Hook, Notifier}; use actix_web::http::header::HeaderMap; - use std::fs::File; - use std::io::{Read, Write}; #[cfg(unix)] use std::os::unix::fs::PermissionsExt; + use std::{ + fs::File, + io::{Read, Write}, + }; use tempdir::TempDir; #[actix_rt::test] diff --git a/src/notifiers/file_notifier.rs b/src/notifiers/file_notifier.rs index 5ac7e31..911c279 100644 --- a/src/notifiers/file_notifier.rs +++ b/src/notifiers/file_notifier.rs @@ -1,6 +1,8 @@ -use crate::errors::RustusError; -use crate::notifiers::{Hook, Notifier}; -use crate::RustusResult; +use crate::{ + errors::RustusError, + notifiers::{Hook, Notifier}, + RustusResult, +}; use actix_web::http::header::HeaderMap; use async_trait::async_trait; use log::debug; @@ -47,10 +49,12 @@ mod tests { use super::FileNotifier; use crate::notifiers::{Hook, Notifier}; use actix_web::http::header::HeaderMap; - use std::fs::File; - use std::io::{Read, Write}; #[cfg(unix)] use std::os::unix::fs::PermissionsExt; + use std::{ + fs::File, + io::{Read, Write}, + }; #[cfg(unix)] #[actix_rt::test] diff --git a/src/notifiers/http_notifier.rs b/src/notifiers/http_notifier.rs index 36956d5..a6887cc 100644 --- a/src/notifiers/http_notifier.rs +++ b/src/notifiers/http_notifier.rs @@ -67,10 +67,8 @@ mod tests { use super::HttpNotifier; use crate::notifiers::{Hook, Notifier}; use actix_web::http::header::{HeaderMap, HeaderName, HeaderValue}; - use httptest::matchers::contains; - use httptest::responders::status_code; - use std::str::FromStr; - use std::time::Duration; + use httptest::{matchers::contains, responders::status_code}; + use std::{str::FromStr, time::Duration}; #[actix_rt::test] async fn success_request() { diff --git a/src/notifiers/mod.rs b/src/notifiers/mod.rs index 0359510..d9957a1 100644 --- a/src/notifiers/mod.rs +++ b/src/notifiers/mod.rs @@ -6,6 +6,4 @@ mod file_notifier; pub mod http_notifier; pub mod models; -pub use models::hooks::Hook; -pub use models::message_format::Format; -pub use models::notifier::Notifier; +pub use models::{hooks::Hook, message_format::Format, notifier::Notifier}; diff --git a/src/notifiers/models/message_format.rs b/src/notifiers/models/message_format.rs index 6d80200..9a00077 100644 --- a/src/notifiers/models/message_format.rs +++ b/src/notifiers/models/message_format.rs @@ -1,10 +1,8 @@ -use crate::errors::RustusResult; -use crate::info_storages::FileInfo; +use crate::{errors::RustusResult, info_storages::FileInfo}; use actix_web::HttpRequest; use derive_more::{Display, From}; use serde::Serialize; -use serde_json::Map; -use serde_json::Value; +use serde_json::{Map, Value}; use std::collections::HashMap; use crate::from_str; diff --git a/src/notifiers/models/notification_manager.rs b/src/notifiers/models/notification_manager.rs index 68c2ae9..441c99a 100644 --- a/src/notifiers/models/notification_manager.rs +++ b/src/notifiers/models/notification_manager.rs @@ -1,12 +1,12 @@ -use crate::errors::RustusResult; #[cfg(feature = "amqp_notifier")] use crate::notifiers::amqp_notifier; -use crate::notifiers::dir_notifier::DirNotifier; -use crate::notifiers::file_notifier::FileNotifier; #[cfg(feature = "http_notifier")] use crate::notifiers::http_notifier; -use crate::notifiers::{Hook, Notifier}; -use crate::RustusConf; +use crate::{ + errors::RustusResult, + notifiers::{dir_notifier::DirNotifier, file_notifier::FileNotifier, Hook, Notifier}, + RustusConf, +}; use actix_web::http::header::HeaderMap; use log::debug; diff --git a/src/protocol/core/get_info.rs b/src/protocol/core/get_info.rs index 8daf5d6..ddb014a 100644 --- a/src/protocol/core/get_info.rs +++ b/src/protocol/core/get_info.rs @@ -68,8 +68,10 @@ mod tests { use actix_web::http::{Method, StatusCode}; use crate::{rustus_service, State}; - use actix_web::test::{call_service, init_service, TestRequest}; - use actix_web::{web, App}; + use actix_web::{ + test::{call_service, init_service, TestRequest}, + web, App, + }; #[actix_rt::test] async fn success() { diff --git a/src/protocol/core/server_info.rs b/src/protocol/core/server_info.rs index f5217cd..3648e84 100644 --- a/src/protocol/core/server_info.rs +++ b/src/protocol/core/server_info.rs @@ -19,12 +19,10 @@ pub async fn server_info(state: web::Data) -> HttpResponse { #[cfg(test)] mod tests { - use crate::protocol::extensions::Extensions; - use crate::{rustus_service, State}; + use crate::{protocol::extensions::Extensions, rustus_service, State}; use actix_web::test::{call_service, init_service, TestRequest}; - use actix_web::http::Method; - use actix_web::{web, App}; + use actix_web::{http::Method, web, App}; #[actix_rt::test] async fn test_server_info() { diff --git a/src/protocol/core/write_bytes.rs b/src/protocol/core/write_bytes.rs index 9adb0b4..93cf900 100644 --- a/src/protocol/core/write_bytes.rs +++ b/src/protocol/core/write_bytes.rs @@ -1,10 +1,12 @@ use actix_web::{web, web::Bytes, HttpRequest, HttpResponse}; -use crate::errors::RustusError; -use crate::notifiers::Hook; -use crate::protocol::extensions::Extensions; -use crate::utils::headers::{check_header, parse_header}; -use crate::{RustusResult, State}; +use crate::{ + errors::RustusError, + notifiers::Hook, + protocol::extensions::Extensions, + utils::headers::{check_header, parse_header}, + RustusResult, State, +}; pub async fn write_bytes( request: HttpRequest, @@ -125,9 +127,11 @@ pub async fn write_bytes( #[cfg(test)] mod tests { use crate::{rustus_service, State}; - use actix_web::http::StatusCode; - use actix_web::test::{call_service, init_service, TestRequest}; - use actix_web::{web, App}; + use actix_web::{ + http::StatusCode, + test::{call_service, init_service, TestRequest}, + web, App, + }; #[actix_rt::test] /// Success test for writing bytes. diff --git a/src/protocol/creation/routes.rs b/src/protocol/creation/routes.rs index 7a6828b..c11fe66 100644 --- a/src/protocol/creation/routes.rs +++ b/src/protocol/creation/routes.rs @@ -1,13 +1,14 @@ use std::collections::HashMap; -use actix_web::web::Bytes; -use actix_web::{web, HttpRequest, HttpResponse}; +use actix_web::{web, web::Bytes, HttpRequest, HttpResponse}; -use crate::info_storages::FileInfo; -use crate::notifiers::Hook; -use crate::protocol::extensions::Extensions; -use crate::utils::headers::{check_header, parse_header}; -use crate::State; +use crate::{ + info_storages::FileInfo, + notifiers::Hook, + protocol::extensions::Extensions, + utils::headers::{check_header, parse_header}, + State, +}; /// Get metadata info from request. /// @@ -218,11 +219,12 @@ pub async fn create_file( #[cfg(test)] mod tests { - use crate::server::rustus_service; - use crate::State; - use actix_web::http::StatusCode; - use actix_web::test::{call_service, init_service, TestRequest}; - use actix_web::{web, App}; + use crate::{server::rustus_service, State}; + use actix_web::{ + http::StatusCode, + test::{call_service, init_service, TestRequest}, + web, App, + }; #[actix_rt::test] async fn success() { diff --git a/src/protocol/getting/routes.rs b/src/protocol/getting/routes.rs index f16b8b5..6371d6e 100644 --- a/src/protocol/getting/routes.rs +++ b/src/protocol/getting/routes.rs @@ -1,8 +1,7 @@ use actix_files::NamedFile; use actix_web::{web, HttpRequest}; -use crate::errors::RustusError; -use crate::{RustusResult, State}; +use crate::{errors::RustusError, RustusResult, State}; /// Retrieve actual file. /// @@ -23,9 +22,11 @@ pub async fn get_file(request: HttpRequest, state: web::Data) -> RustusRe #[cfg(test)] mod test { use crate::{rustus_service, State}; - use actix_web::http::StatusCode; - use actix_web::test::{call_service, init_service, TestRequest}; - use actix_web::{web, App}; + use actix_web::{ + http::StatusCode, + test::{call_service, init_service, TestRequest}, + web, App, + }; use bytes::Bytes; #[actix_rt::test] diff --git a/src/protocol/termination/routes.rs b/src/protocol/termination/routes.rs index 33f11a9..8da92a2 100644 --- a/src/protocol/termination/routes.rs +++ b/src/protocol/termination/routes.rs @@ -1,8 +1,10 @@ use actix_web::{web, HttpRequest, HttpResponse}; -use crate::errors::{RustusError, RustusResult}; -use crate::notifiers::Hook; -use crate::State; +use crate::{ + errors::{RustusError, RustusResult}, + notifiers::Hook, + State, +}; /// Terminate uploading. /// @@ -41,9 +43,11 @@ pub async fn terminate( #[cfg(test)] mod tests { use crate::{rustus_service, State}; - use actix_web::http::StatusCode; - use actix_web::test::{call_service, init_service, TestRequest}; - use actix_web::{web, App}; + use actix_web::{ + http::StatusCode, + test::{call_service, init_service, TestRequest}, + web, App, + }; use std::path::PathBuf; #[actix_rt::test] diff --git a/src/server.rs b/src/server.rs index b688e88..02496d3 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1,6 +1,5 @@ use crate::{protocol, State}; -use actix_web::web::PayloadConfig; -use actix_web::{middleware, web}; +use actix_web::{middleware, web, web::PayloadConfig}; pub fn rustus_service(state: web::Data) -> Box { Box::new(move |web_app| { diff --git a/src/storages/file_storage.rs b/src/storages/file_storage.rs index 4f348d7..537378f 100644 --- a/src/storages/file_storage.rs +++ b/src/storages/file_storage.rs @@ -1,17 +1,20 @@ -use std::io::Write; -use std::path::PathBuf; +use std::{io::Write, path::PathBuf}; use actix_files::NamedFile; use async_trait::async_trait; use bytes::Bytes; use log::error; -use std::fs::{remove_file, DirBuilder, OpenOptions}; -use std::io::{copy, BufReader, BufWriter}; +use std::{ + fs::{remove_file, DirBuilder, OpenOptions}, + io::{copy, BufReader, BufWriter}, +}; -use crate::errors::{RustusError, RustusResult}; -use crate::info_storages::FileInfo; -use crate::storages::Storage; -use crate::utils::dir_struct::dir_struct; +use crate::{ + errors::{RustusError, RustusResult}, + info_storages::FileInfo, + storages::Storage, + utils::dir_struct::dir_struct, +}; use derive_more::Display; #[derive(Display)] @@ -188,12 +191,13 @@ impl Storage for FileStorage { #[cfg(test)] mod tests { use super::FileStorage; - use crate::info_storages::FileInfo; - use crate::Storage; + use crate::{info_storages::FileInfo, Storage}; use bytes::Bytes; - use std::fs::File; - use std::io::{Read, Write}; - use std::path::PathBuf; + use std::{ + fs::File, + io::{Read, Write}, + path::PathBuf, + }; #[actix_rt::test] async fn preparation() { diff --git a/src/storages/mod.rs b/src/storages/mod.rs index 083458b..eba4b63 100644 --- a/src/storages/mod.rs +++ b/src/storages/mod.rs @@ -1,5 +1,4 @@ pub mod file_storage; mod models; -pub use models::available_stores::AvailableStores; -pub use models::storage::Storage; +pub use models::{available_stores::AvailableStores, storage::Storage}; diff --git a/src/storages/models/available_stores.rs b/src/storages/models/available_stores.rs index 25ff19e..b22c7a9 100644 --- a/src/storages/models/available_stores.rs +++ b/src/storages/models/available_stores.rs @@ -1,5 +1,4 @@ -use crate::storages::file_storage; -use crate::{from_str, RustusConf, Storage}; +use crate::{from_str, storages::file_storage, RustusConf, Storage}; use derive_more::{Display, From}; use strum::EnumIter; diff --git a/src/storages/models/storage.rs b/src/storages/models/storage.rs index c14820b..2ef0f6b 100644 --- a/src/storages/models/storage.rs +++ b/src/storages/models/storage.rs @@ -1,5 +1,4 @@ -use crate::errors::RustusResult; -use crate::info_storages::FileInfo; +use crate::{errors::RustusResult, info_storages::FileInfo}; use actix_files::NamedFile; use async_trait::async_trait; use bytes::Bytes; diff --git a/src/utils/dir_struct.rs b/src/utils/dir_struct.rs index 9c18757..96bb690 100644 --- a/src/utils/dir_struct.rs +++ b/src/utils/dir_struct.rs @@ -1,8 +1,7 @@ use chrono::{Datelike, Timelike}; use lazy_static::lazy_static; use log::error; -use std::collections::HashMap; -use std::env; +use std::{collections::HashMap, env}; lazy_static! { /// Freezing ENVS on startup.