From bc9314ff2a0befee5ce2cc8558aa96069eb1486c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= Date: Thu, 18 Nov 2021 21:32:33 +0100 Subject: [PATCH] Remove "expect" from fallible code code would crash if handling pointer capture outside of winit on every mouse click we swallow the error since we could not think of a case where this would fail in a way that would want to handle that it fails --- src/platform_impl/web/web_sys/canvas/pointer_handler.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/platform_impl/web/web_sys/canvas/pointer_handler.rs b/src/platform_impl/web/web_sys/canvas/pointer_handler.rs index 5f6f321016..85a99eb8ab 100644 --- a/src/platform_impl/web/web_sys/canvas/pointer_handler.rs +++ b/src/platform_impl/web/web_sys/canvas/pointer_handler.rs @@ -79,9 +79,11 @@ impl PointerHandler { event::mouse_button(&event), event::mouse_modifiers(&event), ); - canvas - .set_pointer_capture(event.pointer_id()) - .expect("Failed to set pointer capture"); + + // Error is swallowed here since the error would occur every time the mouse is + // clicked when the cursor is grabbed, and there is probably not a situation where + // this could fail, that we care if it fails. + let _e = canvas.set_pointer_capture(event.pointer_id()); }, )); }