diff --git a/xilem_core/examples/filesystem.rs b/xilem_core/examples/filesystem.rs index 58bd853f7..68b30c214 100644 --- a/xilem_core/examples/filesystem.rs +++ b/xilem_core/examples/filesystem.rs @@ -4,7 +4,6 @@ //! An example using Xilem Core to manipulate a filesystem. #![expect(clippy::use_self, reason = "Deferred: Noisy")] -#![expect(elided_lifetimes_in_paths, reason = "Deferred: Noisy")] #![expect(let_underscore_drop, reason = "Deferred: Noisy")] use std::io::stdin; @@ -112,7 +111,7 @@ impl SuperElement for FsPath { fn with_downcast_val( this: Self::Mut<'_>, - f: impl FnOnce(Mut) -> R, + f: impl FnOnce(Mut<'_, FsPath>) -> R, ) -> (Self::Mut<'_>, R) { let ret = f(this); (this, ret) @@ -170,7 +169,7 @@ impl View for File { prev: &Self, _view_state: &mut Self::ViewState, ctx: &mut ViewCtx, - element: Mut, + element: Mut<'_, Self::Element>, ) { if prev.name != self.name { let new_path = ctx.current_folder_path.join(&*self.name); @@ -186,7 +185,7 @@ impl View for File { &self, _view_state: &mut Self::ViewState, _ctx: &mut ViewCtx, - element: Mut, + element: Mut<'_, Self::Element>, ) { let _ = std::fs::remove_file(element); } diff --git a/xilem_core/examples/user_interface.rs b/xilem_core/examples/user_interface.rs index f0707a83b..a59d521ad 100644 --- a/xilem_core/examples/user_interface.rs +++ b/xilem_core/examples/user_interface.rs @@ -3,8 +3,6 @@ //! Model version of Masonry for exploration -#![expect(elided_lifetimes_in_paths, reason = "Deferred: Noisy")] - use core::any::Any; use xilem_core::{ @@ -66,7 +64,7 @@ impl View for Button { _prev: &Self, _view_state: &mut Self::ViewState, _ctx: &mut ViewCtx, - _element: Mut, + _element: Mut<'_, Self::Element>, ) { // Nothing to do } @@ -75,7 +73,7 @@ impl View for Button { &self, _view_state: &mut Self::ViewState, _ctx: &mut ViewCtx, - _element: Mut, + _element: Mut<'_, Self::Element>, ) { // Nothing to do } diff --git a/xilem_core/src/any_view.rs b/xilem_core/src/any_view.rs index 9d5d528e2..d3d5e1136 100644 --- a/xilem_core/src/any_view.rs +++ b/xilem_core/src/any_view.rs @@ -200,7 +200,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.dyn_rebuild(view_state, ctx, prev, element); } @@ -209,7 +209,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.dyn_teardown(view_state, ctx, element); } @@ -254,7 +254,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.dyn_rebuild(view_state, ctx, prev, element); } @@ -263,7 +263,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.dyn_teardown(view_state, ctx, element); } @@ -306,7 +306,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.dyn_rebuild(view_state, ctx, prev, element); } @@ -315,7 +315,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.dyn_teardown(view_state, ctx, element); } @@ -358,7 +358,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.dyn_rebuild(view_state, ctx, prev, element); } @@ -367,7 +367,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.dyn_teardown(view_state, ctx, element); } diff --git a/xilem_core/src/element.rs b/xilem_core/src/element.rs index e1a33d063..beb3de37c 100644 --- a/xilem_core/src/element.rs +++ b/xilem_core/src/element.rs @@ -58,7 +58,7 @@ where /// You can safely use this methods in contexts where it is known that the /// /// If you need to return a value, see [`with_downcast_val`](SuperElement::with_downcast_val). - fn with_downcast(this: Mut, f: impl FnOnce(Mut)) -> Mut { + fn with_downcast(this: Mut<'_, Self>, f: impl FnOnce(Mut<'_, Child>)) -> Mut<'_, Self> { let (this, ()) = Self::with_downcast_val(this, f); this } @@ -68,8 +68,10 @@ where /// `Self::upcast`. /// /// If you don't need to return a value, see [`with_downcast`](SuperElement::with_downcast). - fn with_downcast_val(this: Mut, f: impl FnOnce(Mut) -> R) - -> (Self::Mut<'_>, R); + fn with_downcast_val( + this: Mut<'_, Self>, + f: impl FnOnce(Mut<'_, Child>) -> R, + ) -> (Self::Mut<'_>, R); } /// An element which can be used for an [`AnyView`](crate::AnyView) containing `Child`. @@ -100,8 +102,8 @@ impl SuperElement for NoElement { } fn with_downcast_val( - this: Mut, - f: impl FnOnce(Mut) -> R, + this: Mut<'_, Self>, + f: impl FnOnce(Mut<'_, NoElement>) -> R, ) -> (Self::Mut<'_>, R) { ((), f(this)) } diff --git a/xilem_core/src/lib.rs b/xilem_core/src/lib.rs index 6a24e6367..1a953b50a 100644 --- a/xilem_core/src/lib.rs +++ b/xilem_core/src/lib.rs @@ -28,7 +28,6 @@ #![expect(single_use_lifetimes, reason = "Deferred: Noisy")] #![expect(clippy::exhaustive_enums, reason = "Deferred: Noisy")] #![expect(clippy::missing_assert_message, reason = "Deferred: Noisy")] -#![expect(elided_lifetimes_in_paths, reason = "Deferred: Noisy")] #![expect(clippy::use_self, reason = "Deferred: Noisy")] #![expect(clippy::missing_errors_doc, reason = "Can be quite noisy?")] #![expect( diff --git a/xilem_core/src/view.rs b/xilem_core/src/view.rs index 84296e728..8f6491511 100644 --- a/xilem_core/src/view.rs +++ b/xilem_core/src/view.rs @@ -81,7 +81,7 @@ pub trait View: prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ); /// Handle `element` being removed from the tree. @@ -95,7 +95,7 @@ pub trait View: &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ); /// Route `message` to `id_path`, if that is still a valid path. @@ -179,7 +179,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.deref().rebuild(prev, view_state, ctx, element); } @@ -188,7 +188,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.deref().teardown(view_state, ctx, element); } @@ -242,7 +242,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { if core::mem::take(&mut view_state.dirty) || !Arc::ptr_eq(self, prev) { self.deref() @@ -254,7 +254,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.deref() .teardown(&mut view_state.view_state, ctx, element); @@ -303,7 +303,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { if core::mem::take(&mut view_state.dirty) || !Rc::ptr_eq(self, prev) { self.deref() @@ -315,7 +315,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.deref() .teardown(&mut view_state.view_state, ctx, element); diff --git a/xilem_core/src/views/adapt.rs b/xilem_core/src/views/adapt.rs index d92155de1..f775e58ff 100644 --- a/xilem_core/src/views/adapt.rs +++ b/xilem_core/src/views/adapt.rs @@ -17,7 +17,7 @@ pub struct Adapt< Message, ProxyFn = fn( &mut ParentState, - AdaptThunk, + AdaptThunk<'_, ChildState, ChildAction, Context, ChildView, Message>, ) -> MessageResult, > { proxy_fn: ProxyFn, @@ -120,7 +120,7 @@ where ChildView: View, ProxyFn: Fn( &mut ParentState, - AdaptThunk, + AdaptThunk<'_, ChildState, ChildAction, Context, ChildView, Message>, ) -> MessageResult + 'static, { @@ -163,7 +163,7 @@ where V: View, F: Fn( &mut ParentState, - AdaptThunk, + AdaptThunk<'_, ChildState, ChildAction, Context, V, Message>, ) -> MessageResult + 'static, { @@ -180,7 +180,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.child.rebuild(&prev.child, view_state, ctx, element); } @@ -189,7 +189,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.child.teardown(view_state, ctx, element); } diff --git a/xilem_core/src/views/fork.rs b/xilem_core/src/views/fork.rs index 1ef634de4..d42415b4e 100644 --- a/xilem_core/src/views/fork.rs +++ b/xilem_core/src/views/fork.rs @@ -53,7 +53,7 @@ where prev: &Self, (active_state, alongside_state): &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { ctx.with_id(ViewId::new(0), |ctx| { self.active_view @@ -73,7 +73,7 @@ where &self, (active_state, alongside_state): &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { ctx.with_id(ViewId::new(0), |ctx| { self.alongside_view diff --git a/xilem_core/src/views/map_action.rs b/xilem_core/src/views/map_action.rs index cb95906e8..b74a95044 100644 --- a/xilem_core/src/views/map_action.rs +++ b/xilem_core/src/views/map_action.rs @@ -110,7 +110,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.child.rebuild(&prev.child, view_state, ctx, element); } @@ -119,7 +119,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.child.teardown(view_state, ctx, element); } diff --git a/xilem_core/src/views/map_state.rs b/xilem_core/src/views/map_state.rs index 713d8947d..b0dee66ad 100644 --- a/xilem_core/src/views/map_state.rs +++ b/xilem_core/src/views/map_state.rs @@ -152,7 +152,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.child.rebuild(&prev.child, view_state, ctx, element); } @@ -161,7 +161,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { self.child.teardown(view_state, ctx, element); } diff --git a/xilem_core/src/views/memoize.rs b/xilem_core/src/views/memoize.rs index f68c3eaef..d047055e8 100644 --- a/xilem_core/src/views/memoize.rs +++ b/xilem_core/src/views/memoize.rs @@ -113,7 +113,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { if core::mem::take(&mut view_state.dirty) || prev.data != self.data { let view = (self.init_view)(&self.data); @@ -143,7 +143,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { view_state .view @@ -224,7 +224,7 @@ where _prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { if core::mem::take(&mut view_state.dirty) { let view = (self.init_view)(); @@ -239,7 +239,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { view_state .view diff --git a/xilem_core/src/views/one_of.rs b/xilem_core/src/views/one_of.rs index 23cdf2459..5e738bc23 100644 --- a/xilem_core/src/views/one_of.rs +++ b/xilem_core/src/views/one_of.rs @@ -132,39 +132,39 @@ pub trait OneOfCtx< /// Casts the view element `elem` to the `OneOf::A` variant. /// `f` needs to be invoked with that inner `ViewElement` - fn with_downcast_a(elem: &mut Mut, f: impl FnOnce(Mut)); + fn with_downcast_a(elem: &mut Mut<'_, Self::OneOfElement>, f: impl FnOnce(Mut<'_, A>)); /// Casts the view element `elem` to the `OneOf::B` variant. /// `f` needs to be invoked with that inner `ViewElement` - fn with_downcast_b(elem: &mut Mut, f: impl FnOnce(Mut)); + fn with_downcast_b(elem: &mut Mut<'_, Self::OneOfElement>, f: impl FnOnce(Mut<'_, B>)); /// Casts the view element `elem` to the `OneOf::C` variant. /// `f` needs to be invoked with that inner `ViewElement` - fn with_downcast_c(elem: &mut Mut, f: impl FnOnce(Mut)); + fn with_downcast_c(elem: &mut Mut<'_, Self::OneOfElement>, f: impl FnOnce(Mut<'_, C>)); /// Casts the view element `elem` to the `OneOf::D` variant. /// `f` needs to be invoked with that inner `ViewElement` - fn with_downcast_d(elem: &mut Mut, f: impl FnOnce(Mut)); + fn with_downcast_d(elem: &mut Mut<'_, Self::OneOfElement>, f: impl FnOnce(Mut<'_, D>)); /// Casts the view element `elem` to the `OneOf::E` variant. /// `f` needs to be invoked with that inner `ViewElement` - fn with_downcast_e(elem: &mut Mut, f: impl FnOnce(Mut)); + fn with_downcast_e(elem: &mut Mut<'_, Self::OneOfElement>, f: impl FnOnce(Mut<'_, E>)); /// Casts the view element `elem` to the `OneOf::F` variant. /// `f` needs to be invoked with that inner `ViewElement` - fn with_downcast_f(elem: &mut Mut, f: impl FnOnce(Mut)); + fn with_downcast_f(elem: &mut Mut<'_, Self::OneOfElement>, f: impl FnOnce(Mut<'_, F>)); /// Casts the view element `elem` to the `OneOf::G` variant. /// `f` needs to be invoked with that inner `ViewElement` - fn with_downcast_g(elem: &mut Mut, f: impl FnOnce(Mut)); + fn with_downcast_g(elem: &mut Mut<'_, Self::OneOfElement>, f: impl FnOnce(Mut<'_, G>)); /// Casts the view element `elem` to the `OneOf::H` variant. /// `f` needs to be invoked with that inner `ViewElement` - fn with_downcast_h(elem: &mut Mut, f: impl FnOnce(Mut)); + fn with_downcast_h(elem: &mut Mut<'_, Self::OneOfElement>, f: impl FnOnce(Mut<'_, H>)); /// Casts the view element `elem` to the `OneOf::I` variant. /// `f` needs to be invoked with that inner `ViewElement` - fn with_downcast_i(elem: &mut Mut, f: impl FnOnce(Mut)); + fn with_downcast_i(elem: &mut Mut<'_, Self::OneOfElement>, f: impl FnOnce(Mut<'_, I>)); /// Creates the wrapping element, this is used in `View::build` to wrap the inner view element variant fn upcast_one_of_element( @@ -174,7 +174,7 @@ pub trait OneOfCtx< /// When the variant of the inner view element has changed, the wrapping element needs to be updated, this is used in `View::rebuild` fn update_one_of_element_mut( - elem_mut: &mut Mut, + elem_mut: &mut Mut<'_, Self::OneOfElement>, new_elem: OneOf, ); } @@ -280,7 +280,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - mut element: Mut, + mut element: Mut<'_, Self::Element>, ) { let id = ViewId::new(view_state.generation); // If both elements are of the same type, do a simple rebuild @@ -462,7 +462,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut Context, - mut element: Mut, + mut element: Mut<'_, Self::Element>, ) { ctx.with_id(ViewId::new(view_state.generation), |ctx| { match (self, &mut view_state.inner_state) { @@ -573,12 +573,17 @@ mod hidden { _: &Self, _: &mut Self::ViewState, _: &mut Context, - _: crate::Mut, + _: crate::Mut<'_, Self::Element>, ) { match *self {} } - fn teardown(&self, _: &mut Self::ViewState, _: &mut Context, _: crate::Mut) { + fn teardown( + &self, + _: &mut Self::ViewState, + _: &mut Context, + _: crate::Mut<'_, Self::Element>, + ) { match *self {} } diff --git a/xilem_core/src/views/orphan.rs b/xilem_core/src/views/orphan.rs index 54895a1d6..e92684c54 100644 --- a/xilem_core/src/views/orphan.rs +++ b/xilem_core/src/views/orphan.rs @@ -23,7 +23,7 @@ pub trait OrphanView: ViewPathTracker + prev: &V, view_state: &mut Self::OrphanViewState, ctx: &mut Self, - element: Mut, + element: Mut<'_, Self::OrphanElement>, ); /// See [`View::teardown`] @@ -31,7 +31,7 @@ pub trait OrphanView: ViewPathTracker + view: &V, view_state: &mut Self::OrphanViewState, ctx: &mut Self, - element: Mut, + element: Mut<'_, Self::OrphanElement>, ); /// See [`View::message`] @@ -65,7 +65,7 @@ macro_rules! impl_orphan_view_for { prev: &Self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { Context::orphan_rebuild(self, prev, view_state, ctx, element); } @@ -74,7 +74,7 @@ macro_rules! impl_orphan_view_for { &self, view_state: &mut Self::ViewState, ctx: &mut Context, - element: Mut, + element: Mut<'_, Self::Element>, ) { Context::orphan_teardown(self, view_state, ctx, element); } diff --git a/xilem_core/src/views/run_once.rs b/xilem_core/src/views/run_once.rs index d5ecd0823..76217f2f4 100644 --- a/xilem_core/src/views/run_once.rs +++ b/xilem_core/src/views/run_once.rs @@ -103,12 +103,17 @@ where _: &Self, (): &mut Self::ViewState, _: &mut Context, - (): crate::Mut, + (): crate::Mut<'_, Self::Element>, ) { // Nothing to do } - fn teardown(&self, (): &mut Self::ViewState, _: &mut Context, _: crate::Mut) { + fn teardown( + &self, + (): &mut Self::ViewState, + _: &mut Context, + _: crate::Mut<'_, Self::Element>, + ) { // Nothing to do } diff --git a/xilem_core/tests/common/mod.rs b/xilem_core/tests/common/mod.rs index 2c59bedcd..d4959fa57 100644 --- a/xilem_core/tests/common/mod.rs +++ b/xilem_core/tests/common/mod.rs @@ -8,7 +8,6 @@ #![deny(unreachable_pub)] #![expect(clippy::allow_attributes, reason = "Deferred: Noisy")] #![expect(clippy::allow_attributes_without_reason, reason = "Deferred: Noisy")] -#![expect(elided_lifetimes_in_paths, reason = "Deferred: Noisy")] #![expect(clippy::missing_assert_message, reason = "Deferred: Noisy")] #![expect(clippy::use_self, reason = "Deferred: Noisy")] #![expect(single_use_lifetimes, reason = "Deferred: Noisy")] @@ -117,7 +116,7 @@ where prev: &Self, view_state: &mut Self::ViewState, ctx: &mut TestCtx, - element: Mut, + element: Mut<'_, Self::Element>, ) { assert_eq!(&*element.view_path, ctx.view_path()); element.operations.push(Operation::Rebuild { @@ -137,7 +136,7 @@ where &self, view_state: &mut Self::ViewState, ctx: &mut TestCtx, - element: Mut, + element: Mut<'_, Self::Element>, ) { assert_eq!(&*element.view_path, ctx.view_path()); element.operations.push(Operation::Teardown(self.id)); @@ -183,7 +182,7 @@ impl View<(), Action, TestCtx> for OperationView { prev: &Self, _: &mut Self::ViewState, ctx: &mut TestCtx, - element: Mut, + element: Mut<'_, Self::Element>, ) { assert_eq!(&*element.view_path, ctx.view_path()); element.operations.push(Operation::Rebuild { @@ -192,7 +191,12 @@ impl View<(), Action, TestCtx> for OperationView { }); } - fn teardown(&self, _: &mut Self::ViewState, ctx: &mut TestCtx, element: Mut) { + fn teardown( + &self, + _: &mut Self::ViewState, + ctx: &mut TestCtx, + element: Mut<'_, Self::Element>, + ) { assert_eq!(&*element.view_path, ctx.view_path()); element.operations.push(Operation::Teardown(self.0)); } @@ -219,7 +223,7 @@ impl SuperElement for TestElement { fn with_downcast_val( this: Self::Mut<'_>, - f: impl FnOnce(Mut) -> R, + f: impl FnOnce(Mut<'_, TestElement>) -> R, ) -> (Self::Mut<'_>, R) { let ret = f(this); (this, ret) @@ -277,7 +281,7 @@ impl<'a> ElementSplice for SeqTracker<'a> { fn insert(&mut self, element: TestElement) { self.inner.active.push(element); } - fn mutate(&mut self, f: impl FnOnce(Mut) -> R) -> R { + fn mutate(&mut self, f: impl FnOnce(Mut<'_, TestElement>) -> R) -> R { let ix = self.ix; self.ix += 1; f(&mut self.inner.active[ix]) @@ -285,7 +289,7 @@ impl<'a> ElementSplice for SeqTracker<'a> { fn skip(&mut self, n: usize) { self.ix += n; } - fn delete(&mut self, f: impl FnOnce(Mut) -> R) -> R { + fn delete(&mut self, f: impl FnOnce(Mut<'_, TestElement>) -> R) -> R { let ret = f(&mut self.inner.active[self.ix]); let val = self.inner.active.remove(self.ix); self.inner.deleted.push((self.ix, val)); diff --git a/xilem_core/tests/one_of.rs b/xilem_core/tests/one_of.rs index 900f9401d..3df13daa1 100644 --- a/xilem_core/tests/one_of.rs +++ b/xilem_core/tests/one_of.rs @@ -6,7 +6,6 @@ //! This is an integration test so that it can use the infrastructure in [`common`]. #![expect(clippy::match_same_arms, reason = "Deferred: Noisy")] -#![expect(elided_lifetimes_in_paths, reason = "Deferred: Noisy")] #![expect(clippy::missing_assert_message, reason = "Deferred: Noisy")] use xilem_core::one_of::{OneOf, OneOf2, OneOfCtx, PhantomElementCtx}; @@ -64,7 +63,7 @@ impl } fn update_one_of_element_mut( - elem_mut: &mut Mut, + elem_mut: &mut Mut<'_, Self::OneOfElement>, new_elem: OneOf< TestElement, TestElement, @@ -91,60 +90,66 @@ impl } } - fn with_downcast_a(elem: &mut Mut, f: impl FnOnce(Mut)) { + fn with_downcast_a( + elem: &mut Mut<'_, Self::OneOfElement>, + f: impl FnOnce(Mut<'_, TestElement>), + ) { f(elem); } - fn with_downcast_b(elem: &mut Mut, f: impl FnOnce(Mut)) { + fn with_downcast_b( + elem: &mut Mut<'_, Self::OneOfElement>, + f: impl FnOnce(Mut<'_, TestElement>), + ) { f(elem); } // when one of the following would be invoked, it would be an error in the impl of `OneOfN` fn with_downcast_c( - _elem: &mut Mut, - _f: impl FnOnce(Mut<::PhantomElement>), + _elem: &mut Mut<'_, Self::OneOfElement>, + _f: impl FnOnce(Mut<'_, ::PhantomElement>), ) { unreachable!() } fn with_downcast_d( - _elem: &mut Mut, - _f: impl FnOnce(Mut<::PhantomElement>), + _elem: &mut Mut<'_, Self::OneOfElement>, + _f: impl FnOnce(Mut<'_, ::PhantomElement>), ) { unreachable!() } fn with_downcast_e( - _elem: &mut Mut, - _f: impl FnOnce(Mut<::PhantomElement>), + _elem: &mut Mut<'_, Self::OneOfElement>, + _f: impl FnOnce(Mut<'_, ::PhantomElement>), ) { unreachable!() } fn with_downcast_f( - _elem: &mut Mut, - _f: impl FnOnce(Mut<::PhantomElement>), + _elem: &mut Mut<'_, Self::OneOfElement>, + _f: impl FnOnce(Mut<'_, ::PhantomElement>), ) { unreachable!() } fn with_downcast_g( - _elem: &mut Mut, - _f: impl FnOnce(Mut<::PhantomElement>), + _elem: &mut Mut<'_, Self::OneOfElement>, + _f: impl FnOnce(Mut<'_, ::PhantomElement>), ) { unreachable!() } fn with_downcast_h( - _elem: &mut Mut, - _f: impl FnOnce(Mut<::PhantomElement>), + _elem: &mut Mut<'_, Self::OneOfElement>, + _f: impl FnOnce(Mut<'_, ::PhantomElement>), ) { unreachable!() } fn with_downcast_i( - _elem: &mut Mut, - _f: impl FnOnce(Mut<::PhantomElement>), + _elem: &mut Mut<'_, Self::OneOfElement>, + _f: impl FnOnce(Mut<'_, ::PhantomElement>), ) { unreachable!() } diff --git a/xilem_core/tests/orphan.rs b/xilem_core/tests/orphan.rs index 3c4862c6c..f38e08a4f 100644 --- a/xilem_core/tests/orphan.rs +++ b/xilem_core/tests/orphan.rs @@ -6,7 +6,6 @@ //! //! This is an integration test so that it can use the infrastructure in [`common`]. -#![expect(elided_lifetimes_in_paths, reason = "Deferred: Noisy")] #![expect(clippy::missing_assert_message, reason = "Deferred: Noisy")] use xilem_core::{DynMessage, MessageResult, Mut, OrphanView, View, ViewId, ViewPathTracker}; @@ -41,7 +40,7 @@ impl OrphanView<&'static str, State, Action> for TestCtx { prev: &&'static str, generation: &mut Self::OrphanViewState, ctx: &mut Self, - element: Mut, + element: Mut<'_, Self::OrphanElement>, ) { assert_eq!(&*element.view_path, ctx.view_path()); @@ -61,7 +60,7 @@ impl OrphanView<&'static str, State, Action> for TestCtx { _view: &&'static str, generation: &mut Self::OrphanViewState, _ctx: &mut Self, - element: Mut, + element: Mut<'_, Self::OrphanElement>, ) { element.operations.push(Operation::Teardown(*generation)); }