diff --git a/src/app.rs b/src/app.rs index 76baca6f9..4fd6e6396 100644 --- a/src/app.rs +++ b/src/app.rs @@ -351,7 +351,7 @@ where pub struct RuntimeGuard<'a>(Box + 'a>); trait BoxableGuard<'a> {} -impl<'a, T> BoxableGuard<'a> for T {} +impl BoxableGuard<'_> for T {} struct AppSettings { multi_click_threshold: Duration, diff --git a/src/context.rs b/src/context.rs index 0c3b6ece8..6f1a35232 100644 --- a/src/context.rs +++ b/src/context.rs @@ -529,7 +529,7 @@ impl<'context> Deref for EventContext<'context> { } } -impl<'context> DerefMut for EventContext<'context> { +impl DerefMut for EventContext<'_> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.widget } @@ -573,7 +573,7 @@ pub struct GraphicsContext<'context, 'clip, 'gfx, 'pass> { pub gfx: Exclusive<'context, Graphics<'clip, 'gfx, 'pass>>, } -impl<'context, 'clip, 'gfx, 'pass> GraphicsContext<'context, 'clip, 'gfx, 'pass> { +impl<'clip, 'gfx, 'pass> GraphicsContext<'_, 'clip, 'gfx, 'pass> { /// Returns a new instance that borrows from `self`. pub fn borrowed(&mut self) -> GraphicsContext<'_, 'clip, 'gfx, 'pass> { GraphicsContext { @@ -749,7 +749,7 @@ impl Drop for GraphicsContext<'_, '_, '_, '_> { } } -impl<'context, 'clip, 'gfx, 'pass> Deref for GraphicsContext<'context, 'clip, 'gfx, 'pass> { +impl<'context> Deref for GraphicsContext<'context, '_, '_, '_> { type Target = WidgetContext<'context>; fn deref(&self) -> &Self::Target { @@ -757,7 +757,7 @@ impl<'context, 'clip, 'gfx, 'pass> Deref for GraphicsContext<'context, 'clip, 'g } } -impl<'context, 'clip, 'gfx, 'pass> DerefMut for GraphicsContext<'context, 'clip, 'gfx, 'pass> { +impl DerefMut for GraphicsContext<'_, '_, '_, '_> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.widget } @@ -842,7 +842,7 @@ impl<'context, 'clip, 'gfx, 'pass> LayoutContext<'context, 'clip, 'gfx, 'pass> { } } -impl<'context, 'clip, 'gfx, 'pass> AsEventContext for LayoutContext<'context, 'clip, 'gfx, 'pass> { +impl AsEventContext for LayoutContext<'_, '_, '_, '_> { fn as_event_context(&mut self) -> EventContext<'_> { self.graphics.as_event_context() } @@ -856,7 +856,7 @@ impl<'context, 'clip, 'gfx, 'pass> Deref for LayoutContext<'context, 'clip, 'gfx } } -impl<'context, 'clip, 'gfx, 'pass> DerefMut for LayoutContext<'context, 'clip, 'gfx, 'pass> { +impl DerefMut for LayoutContext<'_, '_, '_, '_> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.graphics } diff --git a/src/graphics.rs b/src/graphics.rs index 62def7693..0b76bdace 100644 --- a/src/graphics.rs +++ b/src/graphics.rs @@ -32,7 +32,7 @@ enum RenderContext<'clip, 'gfx, 'pass> { Clipped(ClipGuard<'clip, Renderer<'gfx, 'pass>>), } -impl<'clip, 'gfx, 'pass> Graphics<'clip, 'gfx, 'pass> { +impl<'gfx, 'pass> Graphics<'_, 'gfx, 'pass> { /// Returns a new graphics context for the given [`Renderer`]. #[must_use] pub fn new(renderer: Renderer<'gfx, 'pass>) -> Self { @@ -335,7 +335,7 @@ impl<'clip, 'gfx, 'pass> Graphics<'clip, 'gfx, 'pass> { } } -impl<'gfx, 'pass> Deref for Graphics<'_, 'gfx, 'pass> { +impl Deref for Graphics<'_, '_, '_> { type Target = Kludgine; fn deref(&self) -> &Self::Target { @@ -343,7 +343,7 @@ impl<'gfx, 'pass> Deref for Graphics<'_, 'gfx, 'pass> { } } -impl<'gfx, 'pass> DerefMut for Graphics<'_, 'gfx, 'pass> { +impl DerefMut for Graphics<'_, '_, '_> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.renderer } @@ -360,7 +360,7 @@ impl<'gfx, 'pass> Deref for RenderContext<'_, 'gfx, 'pass> { } } -impl<'gfx, 'pass> DerefMut for RenderContext<'_, 'gfx, 'pass> { +impl DerefMut for RenderContext<'_, '_, '_> { fn deref_mut(&mut self) -> &mut Self::Target { match self { RenderContext::Renderer(renderer) => renderer, diff --git a/src/styles.rs b/src/styles.rs index d24daba49..e39f945c9 100644 --- a/src/styles.rs +++ b/src/styles.rs @@ -2607,7 +2607,7 @@ pub trait ProtoColor: Sized { } } -impl<'a> ProtoColor for &'a ColorSource { +impl ProtoColor for &'_ ColorSource { fn hue(&self) -> OklabHue { self.hue } diff --git a/src/utils.rs b/src/utils.rs index 03d515c9e..58f5a6d20 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -57,7 +57,7 @@ macro_rules! impl_with_clone { }; } -impl<'a, T> WithClone for &'a T +impl WithClone for &'_ T where T: Clone, { diff --git a/src/value.rs b/src/value.rs index 0c8b4c24e..5da9333dc 100644 --- a/src/value.rs +++ b/src/value.rs @@ -1544,7 +1544,7 @@ where } } -impl<'a, T> DynamicMutexGuard<'a, T> { +impl DynamicMutexGuard<'_, T> { fn unlocked(&mut self, while_unlocked: impl FnOnce() -> R) -> R { let previous_state = self.dynamic.during_callback_state.lock().take(); let result = MutexGuard::unlocked(&mut self.guard, while_unlocked); @@ -1554,7 +1554,7 @@ impl<'a, T> DynamicMutexGuard<'a, T> { } } -impl<'a, T> Drop for DynamicMutexGuard<'a, T> { +impl Drop for DynamicMutexGuard<'_, T> { fn drop(&mut self) { let mut during_state = self.dynamic.during_callback_state.lock(); *during_state = None; @@ -1563,14 +1563,14 @@ impl<'a, T> Drop for DynamicMutexGuard<'a, T> { } } -impl<'a, T> Deref for DynamicMutexGuard<'a, T> { +impl Deref for DynamicMutexGuard<'_, T> { type Target = State; fn deref(&self) -> &Self::Target { &self.guard } } -impl<'a, T> DerefMut for DynamicMutexGuard<'a, T> { +impl DerefMut for DynamicMutexGuard<'_, T> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.guard } @@ -2198,7 +2198,7 @@ enum DynamicOrOwnedGuard<'a, T> { Owned(RefMut<'a, GenerationalValue>), OwnedRef(&'a mut GenerationalValue), } -impl<'a, T> DynamicOrOwnedGuard<'a, T> { +impl DynamicOrOwnedGuard<'_, T> { fn note_changed(&mut self) -> Option { match self { Self::Dynamic(guard) => Some(guard.note_changed()), @@ -2214,7 +2214,7 @@ impl<'a, T> DynamicOrOwnedGuard<'a, T> { } } -impl<'a, T> Deref for DynamicOrOwnedGuard<'a, T> { +impl Deref for DynamicOrOwnedGuard<'_, T> { type Target = GenerationalValue; fn deref(&self) -> &Self::Target { @@ -2226,7 +2226,7 @@ impl<'a, T> Deref for DynamicOrOwnedGuard<'a, T> { } } -impl<'a, T> DerefMut for DynamicOrOwnedGuard<'a, T> { +impl DerefMut for DynamicOrOwnedGuard<'_, T> { fn deref_mut(&mut self) -> &mut Self::Target { match self { Self::Dynamic(guard) => &mut guard.wrapped, @@ -2272,7 +2272,7 @@ impl DynamicGuard<'_, T, READONLY> { } } -impl<'a, T, const READONLY: bool> Deref for DynamicGuard<'a, T, READONLY> { +impl Deref for DynamicGuard<'_, T, READONLY> { type Target = T; fn deref(&self) -> &Self::Target { @@ -2280,7 +2280,7 @@ impl<'a, T, const READONLY: bool> Deref for DynamicGuard<'a, T, READONLY> { } } -impl<'a, T> DerefMut for DynamicGuard<'a, T, false> { +impl DerefMut for DynamicGuard<'_, T, false> { fn deref_mut(&mut self) -> &mut Self::Target { self.accessed_mut = true; &mut self.guard.value @@ -2529,7 +2529,7 @@ impl Drop for DynamicReader { #[must_use = "futures must be .await'ed to be executed"] pub struct BlockUntilUpdatedFuture<'a, T>(&'a DynamicReader); -impl<'a, T> Future for BlockUntilUpdatedFuture<'a, T> { +impl Future for BlockUntilUpdatedFuture<'_, T> { type Output = bool; fn poll(self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> Poll { @@ -3087,13 +3087,13 @@ impl IntoValue for T { } } -impl<'a> IntoValue for &'a str { +impl IntoValue for &'_ str { fn into_value(self) -> Value { Value::Constant(self.to_owned()) } } -impl<'a> IntoReadOnly for &'a str { +impl IntoReadOnly for &'_ str { fn into_read_only(self) -> ReadOnly { ReadOnly::Constant(self.to_string()) } diff --git a/src/widgets/menu.rs b/src/widgets/menu.rs index 18e00af39..657ece3b2 100644 --- a/src/widgets/menu.rs +++ b/src/widgets/menu.rs @@ -176,7 +176,7 @@ where /// A [`Menu`] that is preparing to be shown in an [`OverlayLayer`]. pub struct MenuOverlay<'a>(OverlayBuilder<'a>, OpenMenuHandle); -impl<'a> Overlayable for MenuOverlay<'a> { +impl Overlayable for MenuOverlay<'_> { type Handle = OpenMenuHandle; fn hide_on_unhover(self) -> Self { diff --git a/src/window.rs b/src/window.rs index 709c1a7c5..a7db1258f 100644 --- a/src/window.rs +++ b/src/window.rs @@ -309,7 +309,7 @@ impl RunningWindow where W: PlatformWindowImplementation, { - #[allow(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments, clippy::ref_option)] pub(crate) fn new( window: W, kludgine_id: KludgineId, @@ -4688,8 +4688,7 @@ where } fn copy_buffer_aligned_bytes_per_row(width: u32) -> u32 { - (width + COPY_BYTES_PER_ROW_ALIGNMENT - 1) / COPY_BYTES_PER_ROW_ALIGNMENT - * COPY_BYTES_PER_ROW_ALIGNMENT + width.div_ceil(COPY_BYTES_PER_ROW_ALIGNMENT) * COPY_BYTES_PER_ROW_ALIGNMENT } /// An animated PNG recorder.