From 1b3938e54f52e58a2b3c540d13805e8ff9804d0c Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Sat, 29 Apr 2023 08:22:49 -0700 Subject: [PATCH] Clean up casting Get rid of unneeded clone and make syntax nicer. --- examples/with_winit/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/examples/with_winit/src/lib.rs b/examples/with_winit/src/lib.rs index d27ae6a..44d197b 100644 --- a/examples/with_winit/src/lib.rs +++ b/examples/with_winit/src/lib.rs @@ -516,10 +516,7 @@ pub fn main() -> Result<()> { web_sys::window() .and_then(|win| win.document()) .and_then(|doc| doc.body()) - .and_then(|body| { - body.append_child(&web_sys::Element::from(canvas.clone())) - .ok() - }) + .and_then(|body| body.append_child(canvas.as_ref()).ok()) .expect("couldn't append canvas to document body"); _ = web_sys::HtmlElement::from(canvas).focus(); wasm_bindgen_futures::spawn_local(async move {