From 8c54949271fbc76cafece9c341162ebbfb0dec65 Mon Sep 17 00:00:00 2001 From: appflowy Date: Mon, 29 Nov 2021 21:35:17 +0800 Subject: [PATCH] rust fmt --- backend/rustfmt.toml | 2 +- backend/src/config/configuration.rs | 3 +-- backend/src/service/user/auth.rs | 3 ++- frontend/rust-lib/rustfmt.toml | 2 +- .../src/proto/template/derive_meta/derive_meta.tera | 1 + shared-lib/flowy-derive/src/derive_cache/derive_cache.rs | 7 +++---- shared-lib/rustfmt.toml | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/rustfmt.toml b/backend/rustfmt.toml index f236ee21e8..5a9925fc22 100644 --- a/backend/rustfmt.toml +++ b/backend/rustfmt.toml @@ -11,7 +11,7 @@ normalize_doc_attributes = true report_todo = "Always" report_fixme = "Always" imports_layout = "HorizontalVertical" -merge_imports = true +imports_granularity = "Crate" reorder_modules = true reorder_imports = true enum_discrim_align_threshold = 20 diff --git a/backend/src/config/configuration.rs b/backend/src/config/configuration.rs index 48f26eb0f1..5670045adb 100644 --- a/backend/src/config/configuration.rs +++ b/backend/src/config/configuration.rs @@ -64,8 +64,7 @@ pub fn get_configuration() -> Result { .try_into() .expect("Failed to parse APP_ENVIRONMENT."); - settings - .merge(config::File::from(configuration_dir.join(environment.as_str())).required(true))?; + settings.merge(config::File::from(configuration_dir.join(environment.as_str())).required(true))?; // Add in settings from environment variables (with a prefix of APP and '__' as // separator) E.g. `APP_APPLICATION__PORT=5001 would set diff --git a/backend/src/service/user/auth.rs b/backend/src/service/user/auth.rs index 88bb27b624..0fdb20ea5d 100644 --- a/backend/src/service/user/auth.rs +++ b/backend/src/service/user/auth.rs @@ -8,7 +8,8 @@ use backend_service::{ errors::{invalid_params, ErrorCode, ServerError}, response::FlowyResponse, }; - +#[allow(dead_code)] +use chrono::Utc; use flowy_user_infra::{ parser::{UserEmail, UserName, UserPassword}, protobuf::{SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserProfile}, diff --git a/frontend/rust-lib/rustfmt.toml b/frontend/rust-lib/rustfmt.toml index f236ee21e8..5a9925fc22 100644 --- a/frontend/rust-lib/rustfmt.toml +++ b/frontend/rust-lib/rustfmt.toml @@ -11,7 +11,7 @@ normalize_doc_attributes = true report_todo = "Always" report_fixme = "Always" imports_layout = "HorizontalVertical" -merge_imports = true +imports_granularity = "Crate" reorder_modules = true reorder_imports = true enum_discrim_align_threshold = 20 diff --git a/frontend/scripts/flowy-tool/src/proto/template/derive_meta/derive_meta.tera b/frontend/scripts/flowy-tool/src/proto/template/derive_meta/derive_meta.tera index 647811c28e..57d7a46dbe 100644 --- a/frontend/scripts/flowy-tool/src/proto/template/derive_meta/derive_meta.tera +++ b/frontend/scripts/flowy-tool/src/proto/template/derive_meta/derive_meta.tera @@ -1,3 +1,4 @@ +#[rustfmt::skip] pub enum TypeCategory { Array, Map, diff --git a/shared-lib/flowy-derive/src/derive_cache/derive_cache.rs b/shared-lib/flowy-derive/src/derive_cache/derive_cache.rs index a8e069b9f2..6f80c65085 100644 --- a/shared-lib/flowy-derive/src/derive_cache/derive_cache.rs +++ b/shared-lib/flowy-derive/src/derive_cache/derive_cache.rs @@ -1,3 +1,4 @@ +#[rustfmt::skip] pub enum TypeCategory { Array, Map, @@ -76,8 +77,7 @@ pub fn category_from_str(type_str: &str) -> TypeCategory { | "UserToken" | "UserProfile" | "UpdateUserRequest" - | "UpdateUserParams" - => TypeCategory::Protobuf, + | "UpdateUserParams" => TypeCategory::Protobuf, "WorkspaceEvent" | "WorkspaceNotification" | "ErrorCode" @@ -90,8 +90,7 @@ pub fn category_from_str(type_str: &str) -> TypeCategory { | "ExportType" | "RevType" | "WsDataType" - | "WsModule" - => TypeCategory::Enum, + | "WsModule" => TypeCategory::Enum, "Option" => TypeCategory::Opt, _ => TypeCategory::Primitive, diff --git a/shared-lib/rustfmt.toml b/shared-lib/rustfmt.toml index f236ee21e8..5a9925fc22 100644 --- a/shared-lib/rustfmt.toml +++ b/shared-lib/rustfmt.toml @@ -11,7 +11,7 @@ normalize_doc_attributes = true report_todo = "Always" report_fixme = "Always" imports_layout = "HorizontalVertical" -merge_imports = true +imports_granularity = "Crate" reorder_modules = true reorder_imports = true enum_discrim_align_threshold = 20