diff options
author | 2023-06-27 22:46:04 +0200 | |
---|---|---|
committer | 2023-06-27 23:04:50 +0200 | |
commit | 1c26440f0bd8f7a002946524dd4d522ba9fb7f29 (patch) | |
tree | ccbd45daf47ec7adadb9276915700dec6fcd7eff /widget/src/scrollable.rs | |
parent | 412e15b170a61f7d7369122d7d0b089491e1b0ea (diff) | |
download | iced-1c26440f0bd8f7a002946524dd4d522ba9fb7f29.tar.gz iced-1c26440f0bd8f7a002946524dd4d522ba9fb7f29.tar.bz2 iced-1c26440f0bd8f7a002946524dd4d522ba9fb7f29.zip |
Use `Option::filter` instead of `and_then` in `scrollable`
Diffstat (limited to 'widget/src/scrollable.rs')
-rw-r--r-- | widget/src/scrollable.rs | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index 5bc6914c..473124ca 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -1203,21 +1203,13 @@ impl Scrollbars { ) -> Self { let offset = state.offset(direction, bounds, content_bounds); - let show_scrollbar_x = direction.horizontal().and_then(|h| { - if content_bounds.width > bounds.width { - Some(h) - } else { - None - } - }); + let show_scrollbar_x = direction + .horizontal() + .filter(|_| content_bounds.width > bounds.width); - let show_scrollbar_y = direction.vertical().and_then(|v| { - if content_bounds.height > bounds.height { - Some(v) - } else { - None - } - }); + let show_scrollbar_y = direction + .vertical() + .filter(|_| content_bounds.height > bounds.height); let y_scrollbar = if let Some(vertical) = show_scrollbar_y { let Properties { |