From 05bdd052abacb269918e05d0fd0c47601a5c8b8b Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 7 Dec 2023 08:05:33 +0800 Subject: [PATCH] chore: fmt --- .../src/entities/field_entities.rs | 8 ++------ .../src/services/database_view/layout_deps.rs | 18 ++++-------------- .../src/services/field/field_builder.rs | 7 +------ .../src/services/share/csv/import.rs | 9 ++------- 4 files changed, 9 insertions(+), 33 deletions(-) diff --git a/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs index f8cc886258..d76c03ea77 100644 --- a/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs +++ b/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs @@ -218,18 +218,14 @@ impl TryInto for CreateFieldPayloadPB { OrderObjectPosition::End }, CreateFieldPosition::Before => { - let field_id = self - .target_field_id - .ok_or(ErrorCode::InvalidParams)?; + let field_id = self.target_field_id.ok_or(ErrorCode::InvalidParams)?; let field_id = NotEmptyStr::parse(field_id) .map_err(|_| ErrorCode::InvalidParams)? .0; OrderObjectPosition::Before(field_id) }, CreateFieldPosition::After => { - let field_id = self - .target_field_id - .ok_or(ErrorCode::InvalidParams)?; + let field_id = self.target_field_id.ok_or(ErrorCode::InvalidParams)?; let field_id = NotEmptyStr::parse(field_id) .map_err(|_| ErrorCode::InvalidParams)? .0; diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rs index 6c01322b7d..5d5e3b4c3f 100644 --- a/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rs +++ b/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rs @@ -136,26 +136,16 @@ impl DatabaseLayoutDepsResolver { let field_type = FieldType::DateTime; let default_date_type_option = DateTypeOption::default(); let field_id = gen_field_id(); - Field::new( - field_id, - "Date".to_string(), - field_type.into(), - false, - ) - .with_type_option_data(field_type, default_date_type_option.into()) + Field::new(field_id, "Date".to_string(), field_type.into(), false) + .with_type_option_data(field_type, default_date_type_option.into()) } fn create_select_field(&self) -> Field { let field_type = FieldType::SingleSelect; let default_select_type_option = SingleSelectTypeOption::default(); let field_id = gen_field_id(); - Field::new( - field_id, - "Status".to_string(), - field_type.into(), - false, - ) - .with_type_option_data(field_type, default_select_type_option.into()) + Field::new(field_id, "Status".to_string(), field_type.into(), false) + .with_type_option_data(field_type, default_select_type_option.into()) } } diff --git a/frontend/rust-lib/flowy-database2/src/services/field/field_builder.rs b/frontend/rust-lib/flowy-database2/src/services/field/field_builder.rs index 8db9628b75..679e44aa7e 100644 --- a/frontend/rust-lib/flowy-database2/src/services/field/field_builder.rs +++ b/frontend/rust-lib/flowy-database2/src/services/field/field_builder.rs @@ -9,12 +9,7 @@ pub struct FieldBuilder { impl FieldBuilder { pub fn new>(field_type: FieldType, type_option_data: T) -> Self { - let mut field = Field::new( - gen_field_id(), - "".to_string(), - field_type.into(), - false, - ); + let mut field = Field::new(gen_field_id(), "".to_string(), field_type.into(), false); field.width = 150; field .type_options diff --git a/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs b/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs index 8ff901065f..d745211c54 100644 --- a/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs +++ b/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs @@ -144,13 +144,8 @@ fn database_from_fields_and_rows( fn default_field(field_str: String, is_primary: bool) -> Field { let field_type = FieldType::RichText; let type_option_data = default_type_option_data_from_type(&field_type); - Field::new( - gen_field_id(), - field_str, - field_type.into(), - is_primary, - ) - .with_type_option_data(field_type, type_option_data) + Field::new(gen_field_id(), field_str, field_type.into(), is_primary) + .with_type_option_data(field_type, type_option_data) } struct FieldsRows {