fix(style0: simplify find(..).is_some() to any(..) and use += instead (#1081)

This commit is contained in:
Ken Matsui 2022-02-24 19:29:56 +09:00 committed by GitHub
parent 1562672877
commit 31def4102f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -172,7 +172,7 @@ impl<'a> FloatingPaneGrid<'a> {
} else if new_pane_geom.x + new_pane_geom.cols.as_usize() + extra_width
< max_right_coords
{
new_pane_geom.x = new_pane_geom.x + extra_width;
new_pane_geom.x += extra_width;
} else {
new_pane_geom.x =
max_right_coords.saturating_sub(new_pane_geom.cols.as_usize());
@ -209,7 +209,7 @@ impl<'a> FloatingPaneGrid<'a> {
} else if new_pane_geom.y + new_pane_geom.rows.as_usize() + extra_height
< max_bottom_coords
{
new_pane_geom.y = new_pane_geom.y + extra_height;
new_pane_geom.y += extra_height;
} else {
new_pane_geom.y =
max_bottom_coords.saturating_sub(new_pane_geom.rows.as_usize());
@ -1238,6 +1238,5 @@ fn pane_geom_is_unoccupied_and_inside_viewport(
geom: &PaneGeom,
existing_geoms: &[PaneGeom],
) -> bool {
pane_geom_is_inside_viewport(viewport, geom)
&& !existing_geoms.iter().find(|p| *p == geom).is_some()
pane_geom_is_inside_viewport(viewport, geom) && !existing_geoms.iter().any(|p| p == geom)
}