use 'clamp' function (clippy::manual_clamp)
This commit is contained in:
parent
4b7c0ca15a
commit
d3eb8d5ad0
2 changed files with 3 additions and 3 deletions
|
|
@ -55,8 +55,8 @@ impl ColorDerive {
|
|||
fn color_adj(rgb: Rgb, saturation_adj: f32, lightness_adj: f32) -> Rgb {
|
||||
let mut okhsl = Self::rgb_to_okhsl(rgb);
|
||||
|
||||
okhsl.saturation = (okhsl.saturation + saturation_adj).max(0.0).min(1.0);
|
||||
okhsl.lightness = (okhsl.lightness + lightness_adj).max(0.0).min(1.0);
|
||||
okhsl.saturation = (okhsl.saturation + saturation_adj).clamp(0.0, 1.0);
|
||||
okhsl.lightness = (okhsl.lightness + lightness_adj).clamp(0.0, 1.0);
|
||||
|
||||
Self::okhsl_to_rgb(okhsl)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue