diff --git a/wgpu/tests/common/mod.rs b/wgpu/tests/common/mod.rs index 7f9e3fd2048..15115b42f08 100644 --- a/wgpu/tests/common/mod.rs +++ b/wgpu/tests/common/mod.rs @@ -363,7 +363,7 @@ fn initialize_adapter() -> Adapter { #[cfg(all(target_arch = "wasm32", feature = "webgl"))] fn create_html_canvas() -> HtmlCanvasElement { - return web_sys::window() + web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let body = doc.body().unwrap(); @@ -372,18 +372,17 @@ fn create_html_canvas() -> HtmlCanvasElement { body.append_child(&canvas).unwrap(); canvas.dyn_into::().ok() }) - .expect("couldn't append canvas to document body"); + .expect("couldn't append canvas to document body") } #[cfg(all(target_arch = "wasm32", feature = "webgl"))] fn delete_html_canvas() { web_sys::window() .and_then(|win| win.document()) - .and_then(|document| { + .map(|document| { if let Some(element) = document.get_element_by_id(CANVAS_ID) { element.remove(); } - Some(()) }); }