Fix `elided_lifetimes_in_path` in Xilem Core (#740)

This commit is contained in:
Daniel McNab 2024-11-12 11:12:12 +00:00 committed by GitHub
parent 2b509fb5e6
commit 751bd62765
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 110 additions and 94 deletions

View File

@ -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<FsPath, ViewCtx> for FsPath {
fn with_downcast_val<R>(
this: Self::Mut<'_>,
f: impl FnOnce(Mut<FsPath>) -> R,
f: impl FnOnce(Mut<'_, FsPath>) -> R,
) -> (Self::Mut<'_>, R) {
let ret = f(this);
(this, ret)
@ -170,7 +169,7 @@ impl<State, Action> View<State, Action, ViewCtx> for File {
prev: &Self,
_view_state: &mut Self::ViewState,
ctx: &mut ViewCtx,
element: Mut<Self::Element>,
element: Mut<'_, Self::Element>,
) {
if prev.name != self.name {
let new_path = ctx.current_folder_path.join(&*self.name);
@ -186,7 +185,7 @@ impl<State, Action> View<State, Action, ViewCtx> for File {
&self,
_view_state: &mut Self::ViewState,
_ctx: &mut ViewCtx,
element: Mut<Self::Element>,
element: Mut<'_, Self::Element>,
) {
let _ = std::fs::remove_file(element);
}

View File

@ -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<State, Action> View<State, Action, ViewCtx> for Button {
_prev: &Self,
_view_state: &mut Self::ViewState,
_ctx: &mut ViewCtx,
_element: Mut<Self::Element>,
_element: Mut<'_, Self::Element>,
) {
// Nothing to do
}
@ -75,7 +73,7 @@ impl<State, Action> View<State, Action, ViewCtx> for Button {
&self,
_view_state: &mut Self::ViewState,
_ctx: &mut ViewCtx,
_element: Mut<Self::Element>,
_element: Mut<'_, Self::Element>,
) {
// Nothing to do
}

View File

@ -200,7 +200,7 @@ where
prev: &Self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
element: Mut<Self::Element>,
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<Self::Element>,
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<Self::Element>,
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<Self::Element>,
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<Self::Element>,
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<Self::Element>,
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<Self::Element>,
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<Self::Element>,
element: Mut<'_, Self::Element>,
) {
self.dyn_teardown(view_state, ctx, element);
}

View File

@ -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<Self>, f: impl FnOnce(Mut<Child>)) -> Mut<Self> {
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<R>(this: Mut<Self>, f: impl FnOnce(Mut<Child>) -> R)
-> (Self::Mut<'_>, R);
fn with_downcast_val<R>(
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<Context> SuperElement<NoElement, Context> for NoElement {
}
fn with_downcast_val<R>(
this: Mut<Self>,
f: impl FnOnce(Mut<NoElement>) -> R,
this: Mut<'_, Self>,
f: impl FnOnce(Mut<'_, NoElement>) -> R,
) -> (Self::Mut<'_>, R) {
((), f(this))
}

View File

@ -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(

View File

@ -81,7 +81,7 @@ pub trait View<State, Action, Context: ViewPathTracker, Message = DynMessage>:
prev: &Self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
element: Mut<Self::Element>,
element: Mut<'_, Self::Element>,
);
/// Handle `element` being removed from the tree.
@ -95,7 +95,7 @@ pub trait View<State, Action, Context: ViewPathTracker, Message = DynMessage>:
&self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
element: Mut<Self::Element>,
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<Self::Element>,
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<Self::Element>,
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<Self::Element>,
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<Self::Element>,
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<Self::Element>,
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<Self::Element>,
element: Mut<'_, Self::Element>,
) {
self.deref()
.teardown(&mut view_state.view_state, ctx, element);

View File

@ -17,7 +17,7 @@ pub struct Adapt<
Message,
ProxyFn = fn(
&mut ParentState,
AdaptThunk<ChildState, ChildAction, Context, ChildView, Message>,
AdaptThunk<'_, ChildState, ChildAction, Context, ChildView, Message>,
) -> MessageResult<ParentAction>,
> {
proxy_fn: ProxyFn,
@ -120,7 +120,7 @@ where
ChildView: View<ChildState, ChildAction, Context, Message>,
ProxyFn: Fn(
&mut ParentState,
AdaptThunk<ChildState, ChildAction, Context, ChildView, Message>,
AdaptThunk<'_, ChildState, ChildAction, Context, ChildView, Message>,
) -> MessageResult<ParentAction, Message>
+ 'static,
{
@ -163,7 +163,7 @@ where
V: View<ChildState, ChildAction, Context, Message>,
F: Fn(
&mut ParentState,
AdaptThunk<ChildState, ChildAction, Context, V, Message>,
AdaptThunk<'_, ChildState, ChildAction, Context, V, Message>,
) -> MessageResult<ParentAction, Message>
+ 'static,
{
@ -180,7 +180,7 @@ where
prev: &Self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
element: Mut<Self::Element>,
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<Self::Element>,
element: Mut<'_, Self::Element>,
) {
self.child.teardown(view_state, ctx, element);
}

View File

@ -53,7 +53,7 @@ where
prev: &Self,
(active_state, alongside_state): &mut Self::ViewState,
ctx: &mut Context,
element: Mut<Self::Element>,
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<Self::Element>,
element: Mut<'_, Self::Element>,
) {
ctx.with_id(ViewId::new(0), |ctx| {
self.alongside_view

View File

@ -110,7 +110,7 @@ where
prev: &Self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
element: Mut<Self::Element>,
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<Self::Element>,
element: Mut<'_, Self::Element>,
) {
self.child.teardown(view_state, ctx, element);
}

View File

@ -152,7 +152,7 @@ where
prev: &Self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
element: Mut<Self::Element>,
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<Self::Element>,
element: Mut<'_, Self::Element>,
) {
self.child.teardown(view_state, ctx, element);
}

View File

@ -113,7 +113,7 @@ where
prev: &Self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
element: Mut<Self::Element>,
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<Self::Element>,
element: Mut<'_, Self::Element>,
) {
view_state
.view
@ -224,7 +224,7 @@ where
_prev: &Self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
element: Mut<Self::Element>,
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<Self::Element>,
element: Mut<'_, Self::Element>,
) {
view_state
.view

View File

@ -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<Self::OneOfElement>, f: impl FnOnce(Mut<A>));
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<Self::OneOfElement>, f: impl FnOnce(Mut<B>));
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<Self::OneOfElement>, f: impl FnOnce(Mut<C>));
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<Self::OneOfElement>, f: impl FnOnce(Mut<D>));
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<Self::OneOfElement>, f: impl FnOnce(Mut<E>));
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<Self::OneOfElement>, f: impl FnOnce(Mut<F>));
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<Self::OneOfElement>, f: impl FnOnce(Mut<G>));
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<Self::OneOfElement>, f: impl FnOnce(Mut<H>));
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<Self::OneOfElement>, f: impl FnOnce(Mut<I>));
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<Self::OneOfElement>,
elem_mut: &mut Mut<'_, Self::OneOfElement>,
new_elem: OneOf<A, B, C, D, E, F, G, H, I>,
);
}
@ -280,7 +280,7 @@ where
prev: &Self,
view_state: &mut Self::ViewState,
ctx: &mut Context,
mut element: Mut<Self::Element>,
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<Self::Element>,
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<Self::Element>,
_: crate::Mut<'_, Self::Element>,
) {
match *self {}
}
fn teardown(&self, _: &mut Self::ViewState, _: &mut Context, _: crate::Mut<Self::Element>) {
fn teardown(
&self,
_: &mut Self::ViewState,
_: &mut Context,
_: crate::Mut<'_, Self::Element>,
) {
match *self {}
}

View File

@ -23,7 +23,7 @@ pub trait OrphanView<V, State, Action, Message = DynMessage>: ViewPathTracker +
prev: &V,
view_state: &mut Self::OrphanViewState,
ctx: &mut Self,
element: Mut<Self::OrphanElement>,
element: Mut<'_, Self::OrphanElement>,
);
/// See [`View::teardown`]
@ -31,7 +31,7 @@ pub trait OrphanView<V, State, Action, Message = DynMessage>: ViewPathTracker +
view: &V,
view_state: &mut Self::OrphanViewState,
ctx: &mut Self,
element: Mut<Self::OrphanElement>,
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<Self::Element>,
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<Self::Element>,
element: Mut<'_, Self::Element>,
) {
Context::orphan_teardown(self, view_state, ctx, element);
}

View File

@ -103,12 +103,17 @@ where
_: &Self,
(): &mut Self::ViewState,
_: &mut Context,
(): crate::Mut<Self::Element>,
(): crate::Mut<'_, Self::Element>,
) {
// Nothing to do
}
fn teardown(&self, (): &mut Self::ViewState, _: &mut Context, _: crate::Mut<Self::Element>) {
fn teardown(
&self,
(): &mut Self::ViewState,
_: &mut Context,
_: crate::Mut<'_, Self::Element>,
) {
// Nothing to do
}

View File

@ -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<Self::Element>,
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<Self::Element>,
element: Mut<'_, Self::Element>,
) {
assert_eq!(&*element.view_path, ctx.view_path());
element.operations.push(Operation::Teardown(self.id));
@ -183,7 +182,7 @@ impl<const N: u32> View<(), Action, TestCtx> for OperationView<N> {
prev: &Self,
_: &mut Self::ViewState,
ctx: &mut TestCtx,
element: Mut<Self::Element>,
element: Mut<'_, Self::Element>,
) {
assert_eq!(&*element.view_path, ctx.view_path());
element.operations.push(Operation::Rebuild {
@ -192,7 +191,12 @@ impl<const N: u32> View<(), Action, TestCtx> for OperationView<N> {
});
}
fn teardown(&self, _: &mut Self::ViewState, ctx: &mut TestCtx, element: Mut<Self::Element>) {
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<TestElement, TestCtx> for TestElement {
fn with_downcast_val<R>(
this: Self::Mut<'_>,
f: impl FnOnce(Mut<TestElement>) -> R,
f: impl FnOnce(Mut<'_, TestElement>) -> R,
) -> (Self::Mut<'_>, R) {
let ret = f(this);
(this, ret)
@ -277,7 +281,7 @@ impl<'a> ElementSplice<TestElement> for SeqTracker<'a> {
fn insert(&mut self, element: TestElement) {
self.inner.active.push(element);
}
fn mutate<R>(&mut self, f: impl FnOnce(Mut<TestElement>) -> R) -> R {
fn mutate<R>(&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<TestElement> for SeqTracker<'a> {
fn skip(&mut self, n: usize) {
self.ix += n;
}
fn delete<R>(&mut self, f: impl FnOnce(Mut<TestElement>) -> R) -> R {
fn delete<R>(&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));

View File

@ -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<Self::OneOfElement>,
elem_mut: &mut Mut<'_, Self::OneOfElement>,
new_elem: OneOf<
TestElement,
TestElement,
@ -91,60 +90,66 @@ impl
}
}
fn with_downcast_a(elem: &mut Mut<Self::OneOfElement>, f: impl FnOnce(Mut<TestElement>)) {
fn with_downcast_a(
elem: &mut Mut<'_, Self::OneOfElement>,
f: impl FnOnce(Mut<'_, TestElement>),
) {
f(elem);
}
fn with_downcast_b(elem: &mut Mut<Self::OneOfElement>, f: impl FnOnce(Mut<TestElement>)) {
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<Self::OneOfElement>,
_f: impl FnOnce(Mut<<Self as PhantomElementCtx>::PhantomElement>),
_elem: &mut Mut<'_, Self::OneOfElement>,
_f: impl FnOnce(Mut<'_, <Self as PhantomElementCtx>::PhantomElement>),
) {
unreachable!()
}
fn with_downcast_d(
_elem: &mut Mut<Self::OneOfElement>,
_f: impl FnOnce(Mut<<Self as PhantomElementCtx>::PhantomElement>),
_elem: &mut Mut<'_, Self::OneOfElement>,
_f: impl FnOnce(Mut<'_, <Self as PhantomElementCtx>::PhantomElement>),
) {
unreachable!()
}
fn with_downcast_e(
_elem: &mut Mut<Self::OneOfElement>,
_f: impl FnOnce(Mut<<Self as PhantomElementCtx>::PhantomElement>),
_elem: &mut Mut<'_, Self::OneOfElement>,
_f: impl FnOnce(Mut<'_, <Self as PhantomElementCtx>::PhantomElement>),
) {
unreachable!()
}
fn with_downcast_f(
_elem: &mut Mut<Self::OneOfElement>,
_f: impl FnOnce(Mut<<Self as PhantomElementCtx>::PhantomElement>),
_elem: &mut Mut<'_, Self::OneOfElement>,
_f: impl FnOnce(Mut<'_, <Self as PhantomElementCtx>::PhantomElement>),
) {
unreachable!()
}
fn with_downcast_g(
_elem: &mut Mut<Self::OneOfElement>,
_f: impl FnOnce(Mut<<Self as PhantomElementCtx>::PhantomElement>),
_elem: &mut Mut<'_, Self::OneOfElement>,
_f: impl FnOnce(Mut<'_, <Self as PhantomElementCtx>::PhantomElement>),
) {
unreachable!()
}
fn with_downcast_h(
_elem: &mut Mut<Self::OneOfElement>,
_f: impl FnOnce(Mut<<Self as PhantomElementCtx>::PhantomElement>),
_elem: &mut Mut<'_, Self::OneOfElement>,
_f: impl FnOnce(Mut<'_, <Self as PhantomElementCtx>::PhantomElement>),
) {
unreachable!()
}
fn with_downcast_i(
_elem: &mut Mut<Self::OneOfElement>,
_f: impl FnOnce(Mut<<Self as PhantomElementCtx>::PhantomElement>),
_elem: &mut Mut<'_, Self::OneOfElement>,
_f: impl FnOnce(Mut<'_, <Self as PhantomElementCtx>::PhantomElement>),
) {
unreachable!()
}

View File

@ -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<State, Action> OrphanView<&'static str, State, Action> for TestCtx {
prev: &&'static str,
generation: &mut Self::OrphanViewState,
ctx: &mut Self,
element: Mut<Self::OrphanElement>,
element: Mut<'_, Self::OrphanElement>,
) {
assert_eq!(&*element.view_path, ctx.view_path());
@ -61,7 +60,7 @@ impl<State, Action> OrphanView<&'static str, State, Action> for TestCtx {
_view: &&'static str,
generation: &mut Self::OrphanViewState,
_ctx: &mut Self,
element: Mut<Self::OrphanElement>,
element: Mut<'_, Self::OrphanElement>,
) {
element.operations.push(Operation::Teardown(*generation));
}