diff --git a/examples/closures/Cargo.toml b/examples/closures/Cargo.toml index f1dcfc66..7093355d 100644 --- a/examples/closures/Cargo.toml +++ b/examples/closures/Cargo.toml @@ -2,6 +2,7 @@ name = "closures" version = "0.1.0" authors = ["The wasm-bindgen Developers"] +edition = "2018" [lib] crate-type = ["cdylib"] diff --git a/examples/closures/src/lib.rs b/examples/closures/src/lib.rs index 30a28380..92600dd4 100644 --- a/examples/closures/src/lib.rs +++ b/examples/closures/src/lib.rs @@ -1,6 +1,4 @@ -extern crate js_sys; -extern crate wasm_bindgen; -extern crate web_sys; +use web_sys; use js_sys::{Array, Date}; use wasm_bindgen::prelude::*; @@ -67,7 +65,7 @@ fn setup_clock(window: &Window, document: &Document) -> Result<(), JsValue> { .get_element_by_id("current-time") .expect("should have #current-time on the page"); update_time(¤t_time); - let a = Closure::wrap(Box::new(move || update_time(¤t_time)) as Box); + let a = Closure::wrap(Box::new(move || update_time(¤t_time)) as Box); window .set_interval_with_callback_and_timeout_and_arguments_0(a.as_ref().unchecked_ref(), 1000)?; fn update_time(current_time: &Element) { @@ -103,7 +101,7 @@ fn setup_clicker(document: &Document) { let a = Closure::wrap(Box::new(move || { clicks += 1; num_clicks.set_inner_html(&clicks.to_string()); - }) as Box); + }) as Box); document .get_element_by_id("green-square") .expect("should have #green-square on the page")