Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: fix warnings
appflowy3845a75d612c
diff --git a/frontend/rust-lib/flowy-folder/src/macros.rs b/frontend/rust-lib/flowy-folder/src/macros.rsindex 6afcd95f72..11ff6b71f1 100644--- a/frontend/rust-lib/flowy-folder/src/macros.rs+++ b/frontend/rust-lib/flowy-folder/src/macros.rs@@ -28,7 +28,7 @@ macro_rules! impl_def_and_def_mut {impl $target {#[allow(dead_code)]pub fn into_inner(&mut self) -> Vec<$item> {- ::std::mem::replace(&mut self.items, vec![])+ ::std::mem::take(&mut self.items)}#[allow(dead_code)]diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rsindex 73ad555d60..cb8c372991 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs@@ -43,8 +43,8 @@ const YES: &str = "Yes";const NO: &str = "No";impl CellFilterOperation<GridCheckboxFilter, CheckboxCellData> for CheckboxTypeOption {- fn apply_filter(&self, cell_data: CheckboxCellData, filter: &GridCheckboxFilter) -> bool {- return false;+ fn apply_filter(&self, _cell_data: CheckboxCellData, _filter: &GridCheckboxFilter) -> bool {+ false}}@@ -53,7 +53,7 @@ impl CellDataOperation<String> for CheckboxTypeOption {&self,cell_data: T,decoded_field_type: &FieldType,- field_rev: &FieldRevision,+ _field_rev: &FieldRevision,) -> FlowyResult<DecodedCellData>whereT: Into<String>,diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rsindex 01cc71a95b..1bf5228857 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs@@ -118,8 +118,8 @@ impl DateTypeOption {}impl CellFilterOperation<GridDateFilter, AnyCellData> for DateTypeOption {- fn apply_filter(&self, cell_data: AnyCellData, filter: &GridDateFilter) -> bool {- return false;+ fn apply_filter(&self, _cell_data: AnyCellData, _filter: &GridDateFilter) -> bool {+ false}}@@ -128,7 +128,7 @@ impl CellDataOperation<String> for DateTypeOption {&self,cell_data: T,decoded_field_type: &FieldType,- field_rev: &FieldRevision,+ _field_rev: &FieldRevision,) -> FlowyResult<DecodedCellData>whereT: Into<String>,diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rsindex 9c46457982..456dfb19db 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs@@ -141,9 +141,9 @@ impl NumberTypeOption {}}impl CellFilterOperation<GridNumberFilter, AnyCellData> for NumberTypeOption {- fn apply_filter(&self, any_cell_data: AnyCellData, filter: &GridNumberFilter) -> bool {- let number_cell_data = NumberCellData::from_number_type_option(self, any_cell_data);- return false;+ fn apply_filter(&self, any_cell_data: AnyCellData, _filter: &GridNumberFilter) -> bool {+ let _number_cell_data = NumberCellData::from_number_type_option(self, any_cell_data);+ false}}@@ -152,7 +152,7 @@ impl CellDataOperation<String> for NumberTypeOption {&self,cell_data: T,decoded_field_type: &FieldType,- field_rev: &FieldRevision,+ _field_rev: &FieldRevision,) -> FlowyResult<DecodedCellData>whereT: Into<String>,diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rsindex d4d5db2dc6..9d1876b348 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs@@ -98,8 +98,8 @@ impl SelectOptionOperation for SingleSelectTypeOption {}impl CellFilterOperation<GridSelectOptionFilter, SelectOptionIds> for SingleSelectTypeOption {- fn apply_filter(&self, cell_data: SelectOptionIds, filter: &GridSelectOptionFilter) -> bool {- return false;+ fn apply_filter(&self, _cell_data: SelectOptionIds, _filter: &GridSelectOptionFilter) -> bool {+ false}}@@ -108,7 +108,7 @@ impl CellDataOperation<String> for SingleSelectTypeOption {&self,cell_data: T,decoded_field_type: &FieldType,- field_rev: &FieldRevision,+ _field_rev: &FieldRevision,) -> FlowyResult<DecodedCellData>whereT: Into<String>,@@ -201,8 +201,8 @@ impl SelectOptionOperation for MultiSelectTypeOption {}}impl CellFilterOperation<GridSelectOptionFilter, SelectOptionIds> for MultiSelectTypeOption {- fn apply_filter(&self, cell_data: SelectOptionIds, filter: &GridSelectOptionFilter) -> bool {- return false;+ fn apply_filter(&self, _cell_data: SelectOptionIds, _filter: &GridSelectOptionFilter) -> bool {+ false}}impl CellDataOperation<String> for MultiSelectTypeOption {@@ -210,7 +210,7 @@ impl CellDataOperation<String> for MultiSelectTypeOption {&self,cell_data: T,decoded_field_type: &FieldType,- field_rev: &FieldRevision,+ _field_rev: &FieldRevision,) -> FlowyResult<DecodedCellData>whereT: Into<String>,diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rsindex f3fc730d63..54449a9361 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs@@ -33,8 +33,8 @@ pub struct RichTextTypeOption {impl_type_option!(RichTextTypeOption, FieldType::RichText);impl CellFilterOperation<GridTextFilter, TextCellData> for RichTextTypeOption {- fn apply_filter(&self, cell_data: TextCellData, filter: &GridTextFilter) -> bool {- return false;+ fn apply_filter(&self, _cell_data: TextCellData, _filter: &GridTextFilter) -> bool {+ false}}diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rsindex 56b4146b30..9cd0c70426 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option.rs@@ -36,8 +36,8 @@ pub struct URLTypeOption {impl_type_option!(URLTypeOption, FieldType::URL);impl CellFilterOperation<GridTextFilter, URLCellData> for URLTypeOption {- fn apply_filter(&self, cell_data: URLCellData, filter: &GridTextFilter) -> bool {- return false;+ fn apply_filter(&self, _cell_data: URLCellData, _filter: &GridTextFilter) -> bool {+ false}}@@ -46,7 +46,7 @@ impl CellDataOperation<EncodedCellData<URLCellData>> for URLTypeOption {&self,cell_data: T,decoded_field_type: &FieldType,- field_rev: &FieldRevision,+ _field_rev: &FieldRevision,) -> FlowyResult<DecodedCellData>whereT: Into<EncodedCellData<URLCellData>>,@@ -123,7 +123,7 @@ impl FromStr for URLCellData {impl std::convert::From<AnyCellData> for URLCellData {fn from(any_cell_data: AnyCellData) -> Self {- URLCellData::from_str(&any_cell_data.cell_data).unwrap_or(URLCellData::default())+ URLCellData::from_str(&any_cell_data.cell_data).unwrap_or_default()}}diff --git a/frontend/rust-lib/flowy-grid/src/services/filter/filter_cache.rs b/frontend/rust-lib/flowy-grid/src/services/filter/filter_cache.rsindex e299fd69b5..9f381e2874 100644--- a/frontend/rust-lib/flowy-grid/src/services/filter/filter_cache.rs+++ b/frontend/rust-lib/flowy-grid/src/services/filter/filter_cache.rs@@ -1,6 +1,5 @@use crate::entities::{- FieldType, GridBlockChangeset, GridCheckboxFilter, GridDateFilter, GridNumberFilter, GridRowId,- GridSelectOptionFilter, GridTextFilter, InsertedRow,+ FieldType, GridCheckboxFilter, GridDateFilter, GridNumberFilter, GridSelectOptionFilter, GridTextFilter,};use dashmap::DashMap;@@ -35,27 +34,26 @@ impl std::ops::Deref for FilterResultCache {#[derive(Default)]pub(crate) struct FilterResult {- pub(crate) row_id: String,+ #[allow(dead_code)]pub(crate) row_index: i32,pub(crate) visible_by_field_id: HashMap<FilterId, bool>,}impl FilterResult {- pub(crate) fn new(index: i32, row_rev: &RowRevision) -> Self {+ pub(crate) fn new(index: i32, _row_rev: &RowRevision) -> Self {Self {row_index: index,- row_id: row_rev.id.clone(),visible_by_field_id: HashMap::new(),}}pub(crate) fn is_visible(&self) -> bool {- for (_, visible) in &self.visible_by_field_id {+ for visible in self.visible_by_field_id.values() {if visible == &false {return false;}}- return true;+ true}}diff --git a/frontend/rust-lib/flowy-grid/src/services/filter/filter_service.rs b/frontend/rust-lib/flowy-grid/src/services/filter/filter_service.rsindex 8be635d584..97200c5837 100644--- a/frontend/rust-lib/flowy-grid/src/services/filter/filter_service.rs+++ b/frontend/rust-lib/flowy-grid/src/services/filter/filter_service.rs@@ -1,5 +1,5 @@use crate::dart_notification::{send_dart_notification, GridNotification};-use crate::entities::{FieldType, GridBlockChangeset, GridTextFilter};+use crate::entities::{FieldType, GridBlockChangeset};use crate::services::block_manager::GridBlockManager;use crate::services::field::{CheckboxTypeOption, DateTypeOption, MultiSelectTypeOption, NumberTypeOption, RichTextTypeOption,@@ -9,15 +9,15 @@ use crate::services::filter::filter_cache::{reload_filter_cache, FilterCache, FilterId, FilterResult, FilterResultCache,};use crate::services::grid_editor_task::GridServiceTaskScheduler;-use crate::services::row::{AnyCellData, CellDataOperation, CellFilterOperation, GridBlockSnapshot};+use crate::services::row::{AnyCellData, CellFilterOperation, GridBlockSnapshot};use crate::services::tasks::{FilterTaskContext, Task, TaskContent};-use dashmap::mapref::one::{Ref, RefMut};+use flowy_error::FlowyResult;use flowy_grid_data_model::revision::{CellRevision, FieldId, FieldRevision, RowRevision};use flowy_sync::client_grid::GridRevisionPad;use flowy_sync::entities::grid::GridSettingChangesetParams;use rayon::prelude::*;-use std::borrow::Cow;+use std::collections::HashMap;use std::sync::Arc;use tokio::sync::RwLock;@@ -162,7 +162,7 @@ fn filter_row(}}}- return None;+ None}// Return None if there is no change in this cell after applying the filter@@ -193,14 +193,14 @@ fn filter_cell(Some(field_rev.get_type_option_entry::<NumberTypeOption>(field_type_rev)?- .apply_filter(any_cell_data.into(), filter.value()),+ .apply_filter(any_cell_data, filter.value()),)}),FieldType::DateTime => filter_cache.date_filter.get(&filter_id).and_then(|filter| {Some(field_rev.get_type_option_entry::<DateTypeOption>(field_type_rev)?- .apply_filter(any_cell_data.into(), filter.value()),+ .apply_filter(any_cell_data, filter.value()),)}),FieldType::SingleSelect => filter_cache.select_option_filter.get(&filter_id).and_then(|filter| {@@ -237,7 +237,7 @@ fn filter_cell(match filter_result.visible_by_field_id.get(&filter_id) {None => {if is_visible {- return None;+ None} else {filter_result.visible_by_field_id.insert(filter_id, is_visible);Some(())diff --git a/frontend/rust-lib/flowy-grid/tests/grid/field_util.rs b/frontend/rust-lib/flowy-grid/tests/grid/field_util.rsindex 236fe882c6..ea16cde778 100644--- a/frontend/rust-lib/flowy-grid/tests/grid/field_util.rs+++ b/frontend/rust-lib/flowy-grid/tests/grid/field_util.rs@@ -12,7 +12,7 @@ pub fn create_text_field(grid_id: &str) -> (InsertFieldParams, FieldRevision) {let cloned_field_rev = field_rev.clone();let type_option_data = field_rev- .get_type_option_entry::<RichTextTypeOption>(field_rev.field_type_rev.clone())+ .get_type_option_entry::<RichTextTypeOption>(field_rev.field_type_rev).unwrap().protobuf_bytes().to_vec();@@ -45,7 +45,7 @@ pub fn create_single_select_field(grid_id: &str) -> (InsertFieldParams, FieldRevlet field_rev = FieldBuilder::new(single_select).name("Name").visibility(true).build();let cloned_field_rev = field_rev.clone();let type_option_data = field_rev- .get_type_option_entry::<SingleSelectTypeOption>(field_rev.field_type_rev.clone())+ .get_type_option_entry::<SingleSelectTypeOption>(field_rev.field_type_rev).unwrap().protobuf_bytes().to_vec();@@ -54,7 +54,7 @@ pub fn create_single_select_field(grid_id: &str) -> (InsertFieldParams, FieldRevid: field_rev.id,name: field_rev.name,desc: field_rev.desc,- field_type,+ field_type: field_rev.field_type_rev.into(),frozen: field_rev.frozen,visibility: field_rev.visibility,width: field_rev.width,diff --git a/frontend/rust-lib/flowy-grid/tests/grid/row_test.rs b/frontend/rust-lib/flowy-grid/tests/grid/row_test.rsindex 93dbc2d801..7aa7450120 100644--- a/frontend/rust-lib/flowy-grid/tests/grid/row_test.rs+++ b/frontend/rust-lib/flowy-grid/tests/grid/row_test.rs@@ -137,7 +137,7 @@ async fn grid_row_add_date_cell_test() {}let context = builder.build();let date_field = date_field.unwrap();- let cell_rev = context.cell_by_field_id.get(&date_field.id).unwrap().clone();+ let cell_rev = context.cell_by_field_id.get(&date_field.id).unwrap();assert_eq!(decode_any_cell_data(cell_rev, &date_field).parse::<DateCellData>()