From 55f199ee7760a0db92705e48d65d06b9c04319fb Mon Sep 17 00:00:00 2001 From: LachezarLechev Date: Wed, 12 Dec 2018 08:12:51 +0100 Subject: [PATCH] [examples] paint - port to rust 2018 --- examples/paint/Cargo.toml | 1 + examples/paint/src/lib.rs | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/paint/Cargo.toml b/examples/paint/Cargo.toml index 025944f5..f2cc8631 100644 --- a/examples/paint/Cargo.toml +++ b/examples/paint/Cargo.toml @@ -2,6 +2,7 @@ name = "wasm-bindgen-paint" version = "0.1.0" authors = ["The wasm-bindgen Developers"] +edition = "2018" [lib] crate-type = ["cdylib"] diff --git a/examples/paint/src/lib.rs b/examples/paint/src/lib.rs index cdd92333..9b407efb 100644 --- a/examples/paint/src/lib.rs +++ b/examples/paint/src/lib.rs @@ -1,7 +1,3 @@ -extern crate js_sys; -extern crate wasm_bindgen; -extern crate web_sys; - use std::cell::Cell; use std::rc::Rc; use wasm_bindgen::prelude::*; @@ -30,7 +26,7 @@ pub fn start() -> Result<(), JsValue> { context.begin_path(); context.move_to(event.offset_x() as f64, event.offset_y() as f64); pressed.set(true); - }) as Box); + }) as Box); canvas.add_event_listener_with_callback("mousedown", closure.as_ref().unchecked_ref())?; closure.forget(); } @@ -44,7 +40,7 @@ pub fn start() -> Result<(), JsValue> { context.begin_path(); context.move_to(event.offset_x() as f64, event.offset_y() as f64); } - }) as Box); + }) as Box); canvas.add_event_listener_with_callback("mousemove", closure.as_ref().unchecked_ref())?; closure.forget(); } @@ -55,7 +51,7 @@ pub fn start() -> Result<(), JsValue> { pressed.set(false); context.line_to(event.offset_x() as f64, event.offset_y() as f64); context.stroke(); - }) as Box); + }) as Box); canvas.add_event_listener_with_callback("mouseup", closure.as_ref().unchecked_ref())?; closure.forget(); }