Use intermediate type

Again, to fix a clippy warning.
This commit is contained in:
Alexandre Bury 2017-10-13 15:40:33 -07:00
parent 46dec4b0ca
commit a4874beee0

View File

@ -40,6 +40,9 @@ impl<V: View> IdView<V> {
} }
} }
// Shortcut for a boxed callback (for the wrap_call_on_any method).
type BoxedCallback<'a> = Box<for<'b> FnMut(&'b mut Any) + 'a>;
impl<T: View + 'static> ViewWrapper for IdView<T> { impl<T: View + 'static> ViewWrapper for IdView<T> {
type V = T; type V = T;
@ -59,8 +62,7 @@ impl<T: View + 'static> ViewWrapper for IdView<T> {
// Some for<'b> weirdness here to please the borrow checker gods... // Some for<'b> weirdness here to please the borrow checker gods...
fn wrap_call_on_any<'a>( fn wrap_call_on_any<'a>(
&mut self, selector: &Selector, &mut self, selector: &Selector, mut callback: BoxedCallback<'a>
mut callback: Box<for<'b> FnMut(&'b mut Any) + 'a>,
) { ) {
match selector { match selector {
&Selector::Id(id) if id == self.id => callback(self), &Selector::Id(id) if id == self.id => callback(self),