diff options
| author | 2023-09-20 05:23:15 +0200 | |
|---|---|---|
| committer | 2023-09-20 05:23:15 +0200 | |
| commit | 1019d1e518d8ffe760142ccd5ff33d077434c8b9 (patch) | |
| tree | 7535197f040e2e6443a398018e3fb663f90b85fe /widget/src | |
| parent | 14ba939e674ec4d9ca53b506ffa3259d30216e85 (diff) | |
| download | iced-1019d1e518d8ffe760142ccd5ff33d077434c8b9.tar.gz iced-1019d1e518d8ffe760142ccd5ff33d077434c8b9.tar.bz2 iced-1019d1e518d8ffe760142ccd5ff33d077434c8b9.zip | |
Fix `clippy::filter_map_next`
Diffstat (limited to '')
| -rw-r--r-- | widget/src/pane_grid.rs | 25 | 
1 files changed, 11 insertions, 14 deletions
| diff --git a/widget/src/pane_grid.rs b/widget/src/pane_grid.rs index 3fb25972..2d25a543 100644 --- a/widget/src/pane_grid.rs +++ b/widget/src/pane_grid.rs @@ -606,11 +606,10 @@ pub fn update<'a, Message, T: Draggable>(                          } else {                              let dropped_region = contents                                  .zip(layout.children()) -                                .filter_map(|(target, layout)| { +                                .find_map(|(target, layout)| {                                      layout_region(layout, cursor_position)                                          .map(|region| (target, region)) -                                }) -                                .next(); +                                });                              match dropped_region {                                  Some(((target, _), region)) @@ -1151,21 +1150,19 @@ pub struct ResizeEvent {   * Helpers   */  fn hovered_split<'a>( -    splits: impl Iterator<Item = (&'a Split, &'a (Axis, Rectangle, f32))>, +    mut splits: impl Iterator<Item = (&'a Split, &'a (Axis, Rectangle, f32))>,      spacing: f32,      cursor_position: Point,  ) -> Option<(Split, Axis, Rectangle)> { -    splits -        .filter_map(|(split, (axis, region, ratio))| { -            let bounds = axis.split_line_bounds(*region, *ratio, spacing); +    splits.find_map(|(split, (axis, region, ratio))| { +        let bounds = axis.split_line_bounds(*region, *ratio, spacing); -            if bounds.contains(cursor_position) { -                Some((*split, *axis, bounds)) -            } else { -                None -            } -        }) -        .next() +        if bounds.contains(cursor_position) { +            Some((*split, *axis, bounds)) +        } else { +            None +        } +    })  }  /// The visible contents of the [`PaneGrid`] | 
