diff --git a/masonry/src/app_driver.rs b/masonry/src/app_driver.rs index 862bd81ec..d44417518 100644 --- a/masonry/src/app_driver.rs +++ b/masonry/src/app_driver.rs @@ -26,7 +26,7 @@ pub trait AppDriver { fn on_start(&mut self, state: &mut MasonryState) {} } -impl<'a> DriverCtx<'a> { +impl DriverCtx<'_> { // TODO - Add method to create timer /// Return a [`WidgetMut`] to the root widget. diff --git a/masonry/src/contexts.rs b/masonry/src/contexts.rs index ad249530d..a5019dd43 100644 --- a/masonry/src/contexts.rs +++ b/masonry/src/contexts.rs @@ -390,7 +390,7 @@ impl_context_method!(MutateCtx<'_>, EventCtx<'_>, UpdateCtx<'_>, { // --- MARK: WIDGET_MUT --- // Methods to get a child WidgetMut from a parent. -impl<'a> MutateCtx<'a> { +impl MutateCtx<'_> { /// Return a [`WidgetMut`] to a child widget. pub fn get_mut<'c, Child: Widget>( &'c mut self, @@ -1296,7 +1296,7 @@ impl RawWrapperMut<'_, Ctx, W> { } } -impl<'a, Ctx: IsContext, W> Drop for RawWrapperMut<'a, Ctx, W> { +impl Drop for RawWrapperMut<'_, Ctx, W> { fn drop(&mut self) { self.parent_widget_state .merge_up(self.ctx.get_widget_state()); diff --git a/masonry/src/lib.rs b/masonry/src/lib.rs index 56072dad6..f881a4c4e 100644 --- a/masonry/src/lib.rs +++ b/masonry/src/lib.rs @@ -116,7 +116,6 @@ #![expect(let_underscore_drop, reason = "Deferred: Noisy")] #![expect(missing_debug_implementations, reason = "Deferred: Noisy")] #![expect(unused_qualifications, reason = "Deferred: Noisy")] -#![expect(single_use_lifetimes, reason = "Deferred: Noisy")] #![expect(clippy::exhaustive_enums, reason = "Deferred: Noisy")] #![expect(clippy::match_same_arms, reason = "Deferred: Noisy")] #![expect(clippy::cast_possible_truncation, reason = "Deferred: Noisy")] diff --git a/masonry/src/paint_scene_helpers.rs b/masonry/src/paint_scene_helpers.rs index 014b1ed07..1f217e46a 100644 --- a/masonry/src/paint_scene_helpers.rs +++ b/masonry/src/paint_scene_helpers.rs @@ -15,6 +15,10 @@ pub struct UnitPoint { v: f64, } +#[expect( + single_use_lifetimes, + reason = "Anonymous lifetimes in `impl Trait` are unstable" +)] pub fn stroke<'b>( scene: &mut Scene, path: &impl Shape, diff --git a/masonry/src/text/selection.rs b/masonry/src/text/selection.rs index e80f04ee8..3c237c147 100644 --- a/masonry/src/text/selection.rs +++ b/masonry/src/text/selection.rs @@ -763,7 +763,7 @@ impl<'a> StringCursor<'a> { } } -impl<'a> StringCursor<'a> { +impl StringCursor<'_> { /// Set cursor position. pub(crate) fn set(&mut self, position: usize) { self.position = position; diff --git a/masonry/src/tree_arena.rs b/masonry/src/tree_arena.rs index 00026c885..91eb37a7c 100644 --- a/masonry/src/tree_arena.rs +++ b/masonry/src/tree_arena.rs @@ -93,21 +93,21 @@ pub struct ArenaMapMut<'a> { // -- MARK: IMPLS --- -impl<'a, Item> Clone for ArenaRef<'a, Item> { +impl Clone for ArenaRef<'_, Item> { fn clone(&self) -> Self { *self } } -impl<'a, Item> Copy for ArenaRef<'a, Item> {} +impl Copy for ArenaRef<'_, Item> {} -impl<'a, Item> Clone for ArenaRefChildren<'a, Item> { +impl Clone for ArenaRefChildren<'_, Item> { fn clone(&self) -> Self { *self } } -impl<'a, Item> Copy for ArenaRefChildren<'a, Item> {} +impl Copy for ArenaRefChildren<'_, Item> {} impl TreeArena { /// Create an empty tree. @@ -213,7 +213,7 @@ impl TreeNode { } } -impl<'a, Item> ArenaRef<'a, Item> { +impl ArenaRef<'_, Item> { /// Id of the item this handle is associated with. pub fn id(&self) -> u64 { // ArenaRefChildren always has an id when it's a member of ArenaRef @@ -221,7 +221,7 @@ impl<'a, Item> ArenaRef<'a, Item> { } } -impl<'a, Item> ArenaMut<'a, Item> { +impl ArenaMut<'_, Item> { /// Id of the item this handle is associated with. pub fn id(&self) -> u64 { // ArenaMutChildren always has an id when it's a member of ArenaMut @@ -486,7 +486,7 @@ impl<'a, Item> ArenaMutChildren<'a, Item> { } } -impl<'a> ArenaMapRef<'a> { +impl ArenaMapRef<'_> { /// Construct the path of items from the given item to the root of the tree. /// /// The path is in order from the bottom to the top, starting at the given item and ending at @@ -519,7 +519,7 @@ impl<'a> ArenaMapRef<'a> { path } } -impl<'a> ArenaMapMut<'a> { +impl ArenaMapMut<'_> { /// Returns a shared handle equivalent to this one. pub fn reborrow(&self) -> ArenaMapRef<'_> { ArenaMapRef { diff --git a/masonry/src/widget/widget_mut.rs b/masonry/src/widget/widget_mut.rs index df7858cd2..aaeb48230 100644 --- a/masonry/src/widget/widget_mut.rs +++ b/masonry/src/widget/widget_mut.rs @@ -38,7 +38,7 @@ impl Drop for WidgetMut<'_, W> { } } -impl<'w, W: Widget> WidgetMut<'w, W> { +impl WidgetMut<'_, W> { /// Get a `WidgetMut` for the same underlying widget with a shorter lifetime. pub fn reborrow_mut(&mut self) -> WidgetMut<'_, W> { let widget = &mut self.widget; @@ -49,7 +49,7 @@ impl<'w, W: Widget> WidgetMut<'w, W> { } } -impl<'a> WidgetMut<'a, Box> { +impl WidgetMut<'_, Box> { /// Attempt to downcast to `WidgetMut` of concrete Widget type. pub fn try_downcast(&mut self) -> Option> { Some(WidgetMut { diff --git a/masonry/src/widget/widget_ref.rs b/masonry/src/widget/widget_ref.rs index c0d69c68a..87f23cde6 100644 --- a/masonry/src/widget/widget_ref.rs +++ b/masonry/src/widget/widget_ref.rs @@ -28,7 +28,7 @@ pub struct WidgetRef<'w, W: Widget + ?Sized> { // --- TRAIT IMPLS --- #[allow(clippy::non_canonical_clone_impl)] -impl<'w, W: Widget + ?Sized> Clone for WidgetRef<'w, W> { +impl Clone for WidgetRef<'_, W> { fn clone(&self) -> Self { Self { ctx: self.ctx, @@ -37,9 +37,9 @@ impl<'w, W: Widget + ?Sized> Clone for WidgetRef<'w, W> { } } -impl<'w, W: Widget + ?Sized> Copy for WidgetRef<'w, W> {} +impl Copy for WidgetRef<'_, W> {} -impl<'w, W: Widget + ?Sized> std::fmt::Debug for WidgetRef<'w, W> { +impl std::fmt::Debug for WidgetRef<'_, W> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { let widget_name = self.widget.short_type_name(); let display_name = if let Some(debug_text) = self.widget.get_debug_text() { @@ -62,7 +62,7 @@ impl<'w, W: Widget + ?Sized> std::fmt::Debug for WidgetRef<'w, W> { } } -impl<'w, W: Widget + ?Sized> Deref for WidgetRef<'w, W> { +impl Deref for WidgetRef<'_, W> { type Target = W; fn deref(&self) -> &Self::Target {