mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: fix warnings
This commit is contained in:
parent
5b504740ef
commit
3845a75d61
@ -28,7 +28,7 @@ macro_rules! impl_def_and_def_mut {
|
|||||||
impl $target {
|
impl $target {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn into_inner(&mut self) -> Vec<$item> {
|
pub fn into_inner(&mut self) -> Vec<$item> {
|
||||||
::std::mem::replace(&mut self.items, vec![])
|
::std::mem::take(&mut self.items)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
@ -43,8 +43,8 @@ const YES: &str = "Yes";
|
|||||||
const NO: &str = "No";
|
const NO: &str = "No";
|
||||||
|
|
||||||
impl CellFilterOperation<GridCheckboxFilter, CheckboxCellData> for CheckboxTypeOption {
|
impl CellFilterOperation<GridCheckboxFilter, CheckboxCellData> for CheckboxTypeOption {
|
||||||
fn apply_filter(&self, cell_data: CheckboxCellData, filter: &GridCheckboxFilter) -> bool {
|
fn apply_filter(&self, _cell_data: CheckboxCellData, _filter: &GridCheckboxFilter) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ impl CellDataOperation<String> for CheckboxTypeOption {
|
|||||||
&self,
|
&self,
|
||||||
cell_data: T,
|
cell_data: T,
|
||||||
decoded_field_type: &FieldType,
|
decoded_field_type: &FieldType,
|
||||||
field_rev: &FieldRevision,
|
_field_rev: &FieldRevision,
|
||||||
) -> FlowyResult<DecodedCellData>
|
) -> FlowyResult<DecodedCellData>
|
||||||
where
|
where
|
||||||
T: Into<String>,
|
T: Into<String>,
|
||||||
|
@ -118,8 +118,8 @@ impl DateTypeOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CellFilterOperation<GridDateFilter, AnyCellData> for DateTypeOption {
|
impl CellFilterOperation<GridDateFilter, AnyCellData> for DateTypeOption {
|
||||||
fn apply_filter(&self, cell_data: AnyCellData, filter: &GridDateFilter) -> bool {
|
fn apply_filter(&self, _cell_data: AnyCellData, _filter: &GridDateFilter) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ impl CellDataOperation<String> for DateTypeOption {
|
|||||||
&self,
|
&self,
|
||||||
cell_data: T,
|
cell_data: T,
|
||||||
decoded_field_type: &FieldType,
|
decoded_field_type: &FieldType,
|
||||||
field_rev: &FieldRevision,
|
_field_rev: &FieldRevision,
|
||||||
) -> FlowyResult<DecodedCellData>
|
) -> FlowyResult<DecodedCellData>
|
||||||
where
|
where
|
||||||
T: Into<String>,
|
T: Into<String>,
|
||||||
|
@ -141,9 +141,9 @@ impl NumberTypeOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl CellFilterOperation<GridNumberFilter, AnyCellData> for NumberTypeOption {
|
impl CellFilterOperation<GridNumberFilter, AnyCellData> for NumberTypeOption {
|
||||||
fn apply_filter(&self, any_cell_data: AnyCellData, filter: &GridNumberFilter) -> bool {
|
fn apply_filter(&self, any_cell_data: AnyCellData, _filter: &GridNumberFilter) -> bool {
|
||||||
let number_cell_data = NumberCellData::from_number_type_option(self, any_cell_data);
|
let _number_cell_data = NumberCellData::from_number_type_option(self, any_cell_data);
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ impl CellDataOperation<String> for NumberTypeOption {
|
|||||||
&self,
|
&self,
|
||||||
cell_data: T,
|
cell_data: T,
|
||||||
decoded_field_type: &FieldType,
|
decoded_field_type: &FieldType,
|
||||||
field_rev: &FieldRevision,
|
_field_rev: &FieldRevision,
|
||||||
) -> FlowyResult<DecodedCellData>
|
) -> FlowyResult<DecodedCellData>
|
||||||
where
|
where
|
||||||
T: Into<String>,
|
T: Into<String>,
|
||||||
|
@ -98,8 +98,8 @@ impl SelectOptionOperation for SingleSelectTypeOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CellFilterOperation<GridSelectOptionFilter, SelectOptionIds> for SingleSelectTypeOption {
|
impl CellFilterOperation<GridSelectOptionFilter, SelectOptionIds> for SingleSelectTypeOption {
|
||||||
fn apply_filter(&self, cell_data: SelectOptionIds, filter: &GridSelectOptionFilter) -> bool {
|
fn apply_filter(&self, _cell_data: SelectOptionIds, _filter: &GridSelectOptionFilter) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ impl CellDataOperation<String> for SingleSelectTypeOption {
|
|||||||
&self,
|
&self,
|
||||||
cell_data: T,
|
cell_data: T,
|
||||||
decoded_field_type: &FieldType,
|
decoded_field_type: &FieldType,
|
||||||
field_rev: &FieldRevision,
|
_field_rev: &FieldRevision,
|
||||||
) -> FlowyResult<DecodedCellData>
|
) -> FlowyResult<DecodedCellData>
|
||||||
where
|
where
|
||||||
T: Into<String>,
|
T: Into<String>,
|
||||||
@ -201,8 +201,8 @@ impl SelectOptionOperation for MultiSelectTypeOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl CellFilterOperation<GridSelectOptionFilter, SelectOptionIds> for MultiSelectTypeOption {
|
impl CellFilterOperation<GridSelectOptionFilter, SelectOptionIds> for MultiSelectTypeOption {
|
||||||
fn apply_filter(&self, cell_data: SelectOptionIds, filter: &GridSelectOptionFilter) -> bool {
|
fn apply_filter(&self, _cell_data: SelectOptionIds, _filter: &GridSelectOptionFilter) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl CellDataOperation<String> for MultiSelectTypeOption {
|
impl CellDataOperation<String> for MultiSelectTypeOption {
|
||||||
@ -210,7 +210,7 @@ impl CellDataOperation<String> for MultiSelectTypeOption {
|
|||||||
&self,
|
&self,
|
||||||
cell_data: T,
|
cell_data: T,
|
||||||
decoded_field_type: &FieldType,
|
decoded_field_type: &FieldType,
|
||||||
field_rev: &FieldRevision,
|
_field_rev: &FieldRevision,
|
||||||
) -> FlowyResult<DecodedCellData>
|
) -> FlowyResult<DecodedCellData>
|
||||||
where
|
where
|
||||||
T: Into<String>,
|
T: Into<String>,
|
||||||
|
@ -33,8 +33,8 @@ pub struct RichTextTypeOption {
|
|||||||
impl_type_option!(RichTextTypeOption, FieldType::RichText);
|
impl_type_option!(RichTextTypeOption, FieldType::RichText);
|
||||||
|
|
||||||
impl CellFilterOperation<GridTextFilter, TextCellData> for RichTextTypeOption {
|
impl CellFilterOperation<GridTextFilter, TextCellData> for RichTextTypeOption {
|
||||||
fn apply_filter(&self, cell_data: TextCellData, filter: &GridTextFilter) -> bool {
|
fn apply_filter(&self, _cell_data: TextCellData, _filter: &GridTextFilter) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ pub struct URLTypeOption {
|
|||||||
impl_type_option!(URLTypeOption, FieldType::URL);
|
impl_type_option!(URLTypeOption, FieldType::URL);
|
||||||
|
|
||||||
impl CellFilterOperation<GridTextFilter, URLCellData> for URLTypeOption {
|
impl CellFilterOperation<GridTextFilter, URLCellData> for URLTypeOption {
|
||||||
fn apply_filter(&self, cell_data: URLCellData, filter: &GridTextFilter) -> bool {
|
fn apply_filter(&self, _cell_data: URLCellData, _filter: &GridTextFilter) -> bool {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ impl CellDataOperation<EncodedCellData<URLCellData>> for URLTypeOption {
|
|||||||
&self,
|
&self,
|
||||||
cell_data: T,
|
cell_data: T,
|
||||||
decoded_field_type: &FieldType,
|
decoded_field_type: &FieldType,
|
||||||
field_rev: &FieldRevision,
|
_field_rev: &FieldRevision,
|
||||||
) -> FlowyResult<DecodedCellData>
|
) -> FlowyResult<DecodedCellData>
|
||||||
where
|
where
|
||||||
T: Into<EncodedCellData<URLCellData>>,
|
T: Into<EncodedCellData<URLCellData>>,
|
||||||
@ -123,7 +123,7 @@ impl FromStr for URLCellData {
|
|||||||
|
|
||||||
impl std::convert::From<AnyCellData> for URLCellData {
|
impl std::convert::From<AnyCellData> for URLCellData {
|
||||||
fn from(any_cell_data: AnyCellData) -> Self {
|
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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use crate::entities::{
|
use crate::entities::{
|
||||||
FieldType, GridBlockChangeset, GridCheckboxFilter, GridDateFilter, GridNumberFilter, GridRowId,
|
FieldType, GridCheckboxFilter, GridDateFilter, GridNumberFilter, GridSelectOptionFilter, GridTextFilter,
|
||||||
GridSelectOptionFilter, GridTextFilter, InsertedRow,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
@ -35,27 +34,26 @@ impl std::ops::Deref for FilterResultCache {
|
|||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub(crate) struct FilterResult {
|
pub(crate) struct FilterResult {
|
||||||
pub(crate) row_id: String,
|
#[allow(dead_code)]
|
||||||
pub(crate) row_index: i32,
|
pub(crate) row_index: i32,
|
||||||
pub(crate) visible_by_field_id: HashMap<FilterId, bool>,
|
pub(crate) visible_by_field_id: HashMap<FilterId, bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FilterResult {
|
impl FilterResult {
|
||||||
pub(crate) fn new(index: i32, row_rev: &RowRevision) -> Self {
|
pub(crate) fn new(index: i32, _row_rev: &RowRevision) -> Self {
|
||||||
Self {
|
Self {
|
||||||
row_index: index,
|
row_index: index,
|
||||||
row_id: row_rev.id.clone(),
|
|
||||||
visible_by_field_id: HashMap::new(),
|
visible_by_field_id: HashMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_visible(&self) -> bool {
|
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 {
|
if visible == &false {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::dart_notification::{send_dart_notification, GridNotification};
|
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::block_manager::GridBlockManager;
|
||||||
use crate::services::field::{
|
use crate::services::field::{
|
||||||
CheckboxTypeOption, DateTypeOption, MultiSelectTypeOption, NumberTypeOption, RichTextTypeOption,
|
CheckboxTypeOption, DateTypeOption, MultiSelectTypeOption, NumberTypeOption, RichTextTypeOption,
|
||||||
@ -9,15 +9,15 @@ use crate::services::filter::filter_cache::{
|
|||||||
reload_filter_cache, FilterCache, FilterId, FilterResult, FilterResultCache,
|
reload_filter_cache, FilterCache, FilterId, FilterResult, FilterResultCache,
|
||||||
};
|
};
|
||||||
use crate::services::grid_editor_task::GridServiceTaskScheduler;
|
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 crate::services::tasks::{FilterTaskContext, Task, TaskContent};
|
||||||
use dashmap::mapref::one::{Ref, RefMut};
|
|
||||||
use flowy_error::FlowyResult;
|
use flowy_error::FlowyResult;
|
||||||
use flowy_grid_data_model::revision::{CellRevision, FieldId, FieldRevision, RowRevision};
|
use flowy_grid_data_model::revision::{CellRevision, FieldId, FieldRevision, RowRevision};
|
||||||
use flowy_sync::client_grid::GridRevisionPad;
|
use flowy_sync::client_grid::GridRevisionPad;
|
||||||
use flowy_sync::entities::grid::GridSettingChangesetParams;
|
use flowy_sync::entities::grid::GridSettingChangesetParams;
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use std::borrow::Cow;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::RwLock;
|
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
|
// Return None if there is no change in this cell after applying the filter
|
||||||
@ -193,14 +193,14 @@ fn filter_cell(
|
|||||||
Some(
|
Some(
|
||||||
field_rev
|
field_rev
|
||||||
.get_type_option_entry::<NumberTypeOption>(field_type_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| {
|
FieldType::DateTime => filter_cache.date_filter.get(&filter_id).and_then(|filter| {
|
||||||
Some(
|
Some(
|
||||||
field_rev
|
field_rev
|
||||||
.get_type_option_entry::<DateTypeOption>(field_type_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| {
|
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) {
|
match filter_result.visible_by_field_id.get(&filter_id) {
|
||||||
None => {
|
None => {
|
||||||
if is_visible {
|
if is_visible {
|
||||||
return None;
|
None
|
||||||
} else {
|
} else {
|
||||||
filter_result.visible_by_field_id.insert(filter_id, is_visible);
|
filter_result.visible_by_field_id.insert(filter_id, is_visible);
|
||||||
Some(())
|
Some(())
|
||||||
|
@ -12,7 +12,7 @@ pub fn create_text_field(grid_id: &str) -> (InsertFieldParams, FieldRevision) {
|
|||||||
let cloned_field_rev = field_rev.clone();
|
let cloned_field_rev = field_rev.clone();
|
||||||
|
|
||||||
let type_option_data = field_rev
|
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()
|
.unwrap()
|
||||||
.protobuf_bytes()
|
.protobuf_bytes()
|
||||||
.to_vec();
|
.to_vec();
|
||||||
@ -45,7 +45,7 @@ pub fn create_single_select_field(grid_id: &str) -> (InsertFieldParams, FieldRev
|
|||||||
let field_rev = FieldBuilder::new(single_select).name("Name").visibility(true).build();
|
let field_rev = FieldBuilder::new(single_select).name("Name").visibility(true).build();
|
||||||
let cloned_field_rev = field_rev.clone();
|
let cloned_field_rev = field_rev.clone();
|
||||||
let type_option_data = field_rev
|
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()
|
.unwrap()
|
||||||
.protobuf_bytes()
|
.protobuf_bytes()
|
||||||
.to_vec();
|
.to_vec();
|
||||||
@ -54,7 +54,7 @@ pub fn create_single_select_field(grid_id: &str) -> (InsertFieldParams, FieldRev
|
|||||||
id: field_rev.id,
|
id: field_rev.id,
|
||||||
name: field_rev.name,
|
name: field_rev.name,
|
||||||
desc: field_rev.desc,
|
desc: field_rev.desc,
|
||||||
field_type,
|
field_type: field_rev.field_type_rev.into(),
|
||||||
frozen: field_rev.frozen,
|
frozen: field_rev.frozen,
|
||||||
visibility: field_rev.visibility,
|
visibility: field_rev.visibility,
|
||||||
width: field_rev.width,
|
width: field_rev.width,
|
||||||
|
@ -137,7 +137,7 @@ async fn grid_row_add_date_cell_test() {
|
|||||||
}
|
}
|
||||||
let context = builder.build();
|
let context = builder.build();
|
||||||
let date_field = date_field.unwrap();
|
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!(
|
assert_eq!(
|
||||||
decode_any_cell_data(cell_rev, &date_field)
|
decode_any_cell_data(cell_rev, &date_field)
|
||||||
.parse::<DateCellData>()
|
.parse::<DateCellData>()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user