From 87f437d23035fe8cc01e14ed42cdb04abc65aa6a Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Wed, 28 Aug 2024 18:01:13 +0100 Subject: [PATCH] fix clippy warning for clamp pattern in `webgl_thread` (#33230) Signed-off-by: Callum Leslie --- components/canvas/webgl_thread.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 95cd5758586..b8a4bc5582b 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -1046,7 +1046,7 @@ impl WebGLImpl { gl.clear_color(r, g, b, a); }, WebGLCommand::ClearDepth(depth) => { - let value = depth.max(0.).min(1.) as f64; + let value = depth.clamp(0., 1.) as f64; state.depth_clear_value = value; gl.clear_depth(value) }, @@ -1085,7 +1085,7 @@ impl WebGLImpl { state.restore_depth_invariant(gl); }, WebGLCommand::DepthRange(near, far) => { - gl.depth_range(near.max(0.).min(1.) as f64, far.max(0.).min(1.) as f64) + gl.depth_range(near.clamp(0., 1.) as f64, far.clamp(0., 1.) as f64) }, WebGLCommand::Disable(cap) => match cap { gl::SCISSOR_TEST => {