chore: fix warnings

This commit is contained in:
appflowy 2022-08-30 16:45:48 +08:00
parent c6d3fd4b68
commit 6e71d6d325
5 changed files with 24 additions and 26 deletions

View File

@ -112,7 +112,7 @@ class _BoardContentState extends State<BoardContent> {
column,
columnItem,
),
columnConstraints: const BoxConstraints.tightFor(width: 240),
columnConstraints: const BoxConstraints.tightFor(width: 300),
config: AFBoardConfig(
columnBackgroundColor: HexColor.fromHex('#F7F8FC'),
),

View File

@ -93,14 +93,15 @@ BoxDecoration _makeBoxDecoration(BuildContext context) {
final theme = context.read<AppTheme>();
final borderSide = BorderSide(color: theme.shader6, width: 1.0);
return BoxDecoration(
color: theme.surface,
color: Colors.transparent,
border: Border.fromBorderSide(borderSide),
boxShadow: [
boxShadow: const [
BoxShadow(
color: theme.shader6,
spreadRadius: 0,
blurRadius: 2,
offset: Offset.zero)
color: Colors.transparent,
spreadRadius: 0,
blurRadius: 2,
offset: Offset.zero,
)
],
borderRadius: const BorderRadius.all(Radius.circular(6)),
);
@ -120,8 +121,9 @@ class _CardEnterRegion extends StatelessWidget {
builder: (context, onEnter, _) {
List<Widget> children = [child];
if (onEnter) {
children.add(CardAccessoryContainer(accessories: accessories)
.positioned(right: 0));
children.add(CardAccessoryContainer(
accessories: accessories,
).positioned(right: 0));
}
return MouseRegion(

View File

@ -142,7 +142,7 @@ impl GridViewManager {
.move_group_row(&row_rev, &mut row_changeset, &to_group_id, to_row_id.clone())
.await;
if row_changeset.is_empty() == false {
if !row_changeset.is_empty() {
with_row_changeset(row_changeset).await;
}

View File

@ -285,7 +285,7 @@ fn merge_groups(old_groups: &[GroupRevision], groups: Vec<Group>) -> MergeGroupR
}
// Find out the new groups
let new_groups = group_map.into_values().collect::<Vec<Group>>();
let new_groups = group_map.into_values();
for (index, group) in new_groups.into_iter().enumerate() {
merge_result.add_insert_group(index, group);
}
@ -313,7 +313,7 @@ impl MergeGroupResult {
}
fn add_group(&mut self, group: Group) {
self.groups.push(group.clone());
self.groups.push(group);
}
fn add_insert_group(&mut self, index: usize, group: Group) {
@ -331,11 +331,10 @@ fn make_group_view_changeset(
inserted_groups: Vec<InsertedGroupPB>,
updated_group: Vec<Group>,
) -> GroupViewChangesetPB {
let changeset = GroupViewChangesetPB {
GroupViewChangesetPB {
view_id,
inserted_groups,
deleted_groups: vec![],
update_groups: updated_group.into_iter().map(GroupPB::from).collect(),
};
changeset
}
}

View File

@ -98,10 +98,12 @@ where
})
}
// https://stackoverflow.com/questions/69413164/how-to-fix-this-clippy-warning-needless-collect
#[allow(clippy::needless_collect)]
fn update_default_group(
&mut self,
row_rev: &RowRevision,
other_group_changesets: &Vec<GroupChangesetPB>,
other_group_changesets: &[GroupChangesetPB],
) -> GroupChangesetPB {
let default_group = self.configuration.get_mut_default_group();
@ -119,15 +121,14 @@ where
.filter(|row_id| {
// if the [other_group_inserted_row] contains the row_id of the row
// which means the row should not move to the default group.
other_group_inserted_row
!other_group_inserted_row
.iter()
.find(|inserted_row| &inserted_row.row.id == row_id)
.is_none()
.any(|inserted_row| &inserted_row.row.id == row_id)
})
.collect::<Vec<String>>();
let mut changeset = GroupChangesetPB::new(default_group.id.clone());
if default_group_inserted_row.is_empty() == false {
if !default_group_inserted_row.is_empty() {
changeset.inserted_rows.push(InsertedRowPB::new(row_rev.into()));
default_group.add_row(row_rev.into());
}
@ -146,10 +147,7 @@ where
// if the [other_group_delete_rows] contain the inserted_row, which means this row should move
// out from the default_group.
let inserted_row_id = &inserted_row.row.id;
other_group_delete_rows
.iter()
.find(|row_id| inserted_row_id == row_id.clone())
.is_none()
!other_group_delete_rows.iter().any(|row_id| inserted_row_id == row_id)
})
.collect::<Vec<&InsertedRowPB>>();
@ -157,8 +155,7 @@ where
for row in &default_group.rows {
if default_group_deleted_rows
.iter()
.find(|deleted_row| deleted_row.row.id == row.id)
.is_some()
.any(|deleted_row| deleted_row.row.id == row.id)
{
deleted_row_ids.push(row.id.clone());
}