summaryrefslogtreecommitdiffstats
path: root/native/src/widget/scrollable.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2022-12-20 11:45:38 +0100
committerLibravatar GitHub <noreply@github.com>2022-12-20 11:45:38 +0100
commit678de1187994f29e3701740617bb5b1963f80c69 (patch)
tree2971553e7bb3d2b9278b422f33e27c2c5c79e5d0 /native/src/widget/scrollable.rs
parentd2d18479acd987b4a4f6a125c0dda7b2a6661df4 (diff)
parent6bb01b727611b83592f96b2b89371a12e7ce54d8 (diff)
downloadiced-678de1187994f29e3701740617bb5b1963f80c69.tar.gz
iced-678de1187994f29e3701740617bb5b1963f80c69.tar.bz2
iced-678de1187994f29e3701740617bb5b1963f80c69.zip
Merge pull request #1611 from iced-rs/fix/clippy-lints
Fix `clippy` lints for Rust 1.66
Diffstat (limited to 'native/src/widget/scrollable.rs')
-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