Skip to content

Commit

Permalink
examples: Use clamp (#613)
Browse files Browse the repository at this point in the history
This satisfies a clippy lint that is newly enabled in 1.79.
  • Loading branch information
waywardmonkeys committed Jun 13, 2024
1 parent 1ec54c2 commit 7f766ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/scenes/src/pico_svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ fn modify_opacity(mut color: Color, attr_name: &str, node: Node) -> Color {
} else {
opacity.parse().unwrap_or(1.0)
};
color.a = (alpha.min(1.0).max(0.0) * 255.0).round() as u8;
color.a = (alpha.clamp(0.0, 1.0) * 255.0).round() as u8;
color
} else {
color
Expand Down
2 changes: 1 addition & 1 deletion examples/with_winit/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Snapshot {
) where
T: Iterator<Item = &'a u64>,
{
let width = (viewport_width * 0.4).max(200.).min(600.);
let width = (viewport_width * 0.4).clamp(200., 600.);
let height = width * 0.7;
let x_offset = viewport_width - width;
let y_offset = viewport_height - height;
Expand Down

0 comments on commit 7f766ff

Please sign in to comment.