Skip to content

Commit a36656d

Browse files
committed
Backport: Make seed compile with wasm_bindgen >= v0.2.81
1 parent 1dc1ff0 commit a36656d

File tree

6 files changed

+6
-33
lines changed

6 files changed

+6
-33
lines changed

src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::browser::dom::virtual_dom_bridge;
22
use crate::browser::{
33
service::routing,
44
url,
5-
util::{self, window, ClosureNew},
5+
util::{self, window},
66
NextTick, Url,
77
};
88
use crate::virtual_dom::{patch, El, EventHandlerManager, Mailbox, Node, Tag, View};

src/app/builder.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ pub trait InitAPIData {
8888
}
8989

9090
// TODO Remove when removing the other `InitAPI`s.
91-
#[deprecated(
92-
since = "0.5.0",
93-
note = "Used for compatibility with old Init API. Use `BeforeAfterInitAPI` together with `BeforeMount` and `AfterMount` instead."
94-
)]
9591
impl<
9692
Ms: 'static,
9793
Mdl: 'static,
@@ -185,10 +181,6 @@ impl<Ms: 'static, Mdl: 'static + Default, ElC: 'static + View<Ms>, GMs: 'static>
185181
}
186182
}
187183

188-
#[deprecated(
189-
since = "0.5.0",
190-
note = "Used for compatibility with old Init API. Use `BeforeAfterInitAPI` together with `BeforeMount` and `AfterMount` instead."
191-
)]
192184
impl<MP, II> InitAPIData for MountPointInitInitAPI<MP, II> {
193185
type IntoAfterMount = UndefinedAfterMount;
194186
type IntoInit = II;

src/browser/service/routing.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::super::{
22
url,
3-
util::{self, ClosureNew},
3+
util,
44
Url,
55
};
66
use std::convert::{identity, TryFrom, TryInto};
@@ -110,8 +110,9 @@ pub fn setup_link_listener<Ms>(update: impl Fn(Ms) + 'static, routes: fn(Url) ->
110110
where
111111
Ms: 'static,
112112
{
113-
let closure = Closure::new(move |event: web_sys::Event| {
114-
event.target()
113+
let closure: Closure<dyn Fn(web_sys::Event) -> _> =
114+
Closure::new(move |event: web_sys::Event| {
115+
event.target()
115116
.and_then(|et| et.dyn_into::<web_sys::Element>().ok())
116117
.and_then(|el| el.closest("[href]").ok())
117118
.and_then(identity) // Option::flatten not stable (https://github.com/rust-lang/rust/issues/60258)

src/browser/util.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -273,25 +273,6 @@ pub fn set_checked(target: &web_sys::EventTarget, value: bool) -> Result<(), &'s
273273
Err("Only `HtmlInputElement` and `HtmlMenuItemElement` can be used in function `set_checked`.")
274274
}
275275

276-
// @TODO: Delete once `Closure::new` is stable
277-
// https://rustwasm.github.io/wasm-bindgen/api/wasm_bindgen/closure/struct.Closure.html
278-
/// Prevent repetition when wrapping closures.
279-
pub trait ClosureNew<T> {
280-
#[allow(clippy::new_ret_no_self)]
281-
fn new(inner: impl FnMut(T) + 'static) -> Closure<dyn FnMut(T)>
282-
where
283-
T: wasm_bindgen::convert::FromWasmAbi + 'static;
284-
}
285-
impl<T> ClosureNew<T> for Closure<T> {
286-
#[allow(clippy::new_ret_no_self)]
287-
fn new(inner: impl FnMut(T) + 'static) -> Closure<dyn FnMut(T)>
288-
where
289-
T: wasm_bindgen::convert::FromWasmAbi + 'static,
290-
{
291-
Closure::wrap(Box::new(inner))
292-
}
293-
}
294-
295276
/// Convenience function for logging to the web browser's console. See also
296277
/// the log! macro, which is more flexible.
297278
#[cfg(use_nightly)]

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub mod prelude {
9191
ev, input_ev, keyboard_ev, mouse_ev, pointer_ev, raw_ev, simple_ev,
9292
},
9393
browser::util::{
94-
request_animation_frame, ClosureNew, RequestAnimationFrameHandle,
94+
request_animation_frame, RequestAnimationFrameHandle,
9595
RequestAnimationFrameTime,
9696
},
9797
browser::Url,

src/virtual_dom/event_handler_manager/listener.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::browser::util::ClosureNew;
21
use crate::virtual_dom::{Ev, EventHandler, Mailbox};
32
use enclose::enc;
43
use std::{

0 commit comments

Comments
 (0)