summaryrefslogtreecommitdiffstats
path: root/native/src/widget/scrollable.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-12-20 11:31:25 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-12-20 11:31:25 +0100
commit6bb01b727611b83592f96b2b89371a12e7ce54d8 (patch)
treec75ba7d21b0bec1f5000b6e4ababff923d09387c /native/src/widget/scrollable.rs
parente0c728c62c6fd9496de1d442e7476e24fc5e9023 (diff)
downloadiced-6bb01b727611b83592f96b2b89371a12e7ce54d8.tar.gz
iced-6bb01b727611b83592f96b2b89371a12e7ce54d8.tar.bz2
iced-6bb01b727611b83592f96b2b89371a12e7ce54d8.zip
Fix `clippy` lints for Rust 1.66
Diffstat (limited to '')
-rw-r--r--native/src/widget/scrollable.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs
index a5e0e0e3..1af0a6ab 100644
--- a/native/src/widget/scrollable.rs
+++ b/native/src/widget/scrollable.rs
@@ -881,8 +881,7 @@ impl State {
self.offset = Offset::Absolute(
(self.offset.absolute(bounds, content_bounds) - delta_y)
- .max(0.0)
- .min((content_bounds.height - bounds.height) as f32),
+ .clamp(0.0, content_bounds.height - bounds.height),
);
}
@@ -905,7 +904,7 @@ impl State {
/// `0` represents scrollbar at the top, while `1` represents scrollbar at
/// the bottom.
pub fn snap_to(&mut self, percentage: f32) {
- self.offset = Offset::Relative(percentage.max(0.0).min(1.0));
+ self.offset = Offset::Relative(percentage.clamp(0.0, 1.0));
}
/// Unsnaps the current scroll position, if snapped, given the bounds of the