Fix clippy lints (#2119)

This commit is contained in:
James Lindsay
2024-11-29 22:58:49 +00:00
committed by GitHub
parent 00629571f2
commit e3bb11ec1b
32 changed files with 694 additions and 456 deletions

View File

@@ -1103,7 +1103,7 @@ impl RenderSvgSegmentList for Vec<SvgSegment> {
pub struct SvgRenderAttrs<'a>(&'a mut SvgRender);
impl<'a> SvgRenderAttrs<'a> {
impl SvgRenderAttrs<'_> {
pub fn push_complex(&mut self, name: impl Into<SvgSegment>, value: impl FnOnce(&mut SvgRender)) {
self.0.svg.push(" ".into());
self.0.svg.push(name.into());

View File

@@ -125,21 +125,21 @@ where
{
}
impl<'i, 's: 'i, I: 'i, N: Node<'i, I> + ?Sized> Node<'i, I> for &'i N {
impl<'i, I: 'i, N: Node<'i, I> + ?Sized> Node<'i, I> for &'i N {
type Output = N::Output;
fn eval(&'i self, input: I) -> N::Output {
(*self).eval(input)
}
}
#[cfg(feature = "alloc")]
impl<'i, 's: 'i, I: 'i, O: 'i, N: Node<'i, I, Output = O> + ?Sized> Node<'i, I> for Box<N> {
impl<'i, I: 'i, O: 'i, N: Node<'i, I, Output = O> + ?Sized> Node<'i, I> for Box<N> {
type Output = O;
fn eval(&'i self, input: I) -> O {
(**self).eval(input)
}
}
#[cfg(feature = "alloc")]
impl<'i, 's: 'i, I: 'i, O: 'i, N: Node<'i, I, Output = O> + ?Sized> Node<'i, I> for alloc::sync::Arc<N> {
impl<'i, I: 'i, O: 'i, N: Node<'i, I, Output = O> + ?Sized> Node<'i, I> for alloc::sync::Arc<N> {
type Output = O;
fn eval(&'i self, input: I) -> O {
(**self).eval(input)

View File

@@ -15,7 +15,7 @@ pub struct MemoNode<T, CachedNode> {
cache: Arc<Mutex<Option<(u64, T)>>>,
node: CachedNode,
}
impl<'i, 'o: 'i, I: Hash + 'i, T: 'i + Clone + 'o + WasmNotSend, CachedNode: 'i> Node<'i, I> for MemoNode<T, CachedNode>
impl<'i, I: Hash + 'i, T: 'i + Clone + WasmNotSend, CachedNode: 'i> Node<'i, I> for MemoNode<T, CachedNode>
where
CachedNode: for<'any_input> Node<'any_input, I>,
for<'a> <CachedNode as Node<'a, I>>::Output: core::future::Future<Output = T> + WasmNotSend,
@@ -62,7 +62,7 @@ pub struct ImpureMemoNode<I, T, CachedNode> {
_phantom: std::marker::PhantomData<I>,
}
impl<'i, 'o: 'i, I: 'i, T: 'i + Clone + 'o + WasmNotSend, CachedNode: 'i> Node<'i, I> for ImpureMemoNode<I, T, CachedNode>
impl<'i, I: 'i, T: 'i + Clone + WasmNotSend, CachedNode: 'i> Node<'i, I> for ImpureMemoNode<I, T, CachedNode>
where
CachedNode: for<'any_input> Node<'any_input, I>,
for<'a> <CachedNode as Node<'a, I>>::Output: core::future::Future<Output = T> + WasmNotSend,
@@ -224,14 +224,14 @@ pub struct MemoHashGuard<'a, T: Hash> {
inner: &'a mut MemoHash<T>,
}
impl<'a, T: Hash> core::ops::Drop for MemoHashGuard<'a, T> {
impl<T: Hash> core::ops::Drop for MemoHashGuard<'_, T> {
fn drop(&mut self) {
let hash = MemoHash::<T>::calc_hash(&self.inner.value);
self.inner.hash = hash;
}
}
impl<'a, T: Hash> core::ops::Deref for MemoHashGuard<'a, T> {
impl<T: Hash> core::ops::Deref for MemoHashGuard<'_, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
@@ -239,7 +239,7 @@ impl<'a, T: Hash> core::ops::Deref for MemoHashGuard<'a, T> {
}
}
impl<'a, T: Hash> core::ops::DerefMut for MemoHashGuard<'a, T> {
impl<T: Hash> core::ops::DerefMut for MemoHashGuard<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner.value
}

View File

@@ -213,7 +213,7 @@ pub trait Sample {
fn sample(&self, pos: DVec2, area: DVec2) -> Option<Self::Pixel>;
}
impl<'i, T: Sample> Sample for &'i T {
impl<T: Sample> Sample for &T {
type Pixel = T::Pixel;
#[inline(always)]
@@ -229,7 +229,7 @@ pub trait Bitmap {
fn get_pixel(&self, x: u32, y: u32) -> Option<Self::Pixel>;
}
impl<'i, T: Bitmap> Bitmap for &'i T {
impl<T: Bitmap> Bitmap for &T {
type Pixel = T::Pixel;
fn width(&self) -> u32 {
@@ -245,7 +245,7 @@ impl<'i, T: Bitmap> Bitmap for &'i T {
}
}
impl<'i, T: Bitmap> Bitmap for &'i mut T {
impl<T: Bitmap> Bitmap for &mut T {
type Pixel = T::Pixel;
fn width(&self) -> u32 {
@@ -276,7 +276,7 @@ pub trait BitmapMut: Bitmap {
}
}
impl<'i, T: BitmapMut + Bitmap> BitmapMut for &'i mut T {
impl<T: BitmapMut + Bitmap> BitmapMut for &mut T {
fn get_pixel_mut(&mut self, x: u32, y: u32) -> Option<&mut Self::Pixel> {
(*self).get_pixel_mut(x, y)
}

View File

@@ -30,7 +30,7 @@ pub struct ComposeNode<First, Second, I> {
phantom: PhantomData<I>,
}
impl<'i, 'f: 'i, 's: 'i, Input: 'i, First, Second> Node<'i, Input> for ComposeNode<First, Second, Input>
impl<'i, Input: 'i, First, Second> Node<'i, Input> for ComposeNode<First, Second, Input>
where
First: Node<'i, Input>,
Second: Node<'i, <First as Node<'i, Input>>::Output> + 'i,
@@ -43,7 +43,7 @@ where
}
}
impl<'i, First, Second, Input: 'i> ComposeNode<First, Second, Input> {
impl<First, Second, Input> ComposeNode<First, Second, Input> {
pub const fn new(first: First, second: Second) -> Self {
ComposeNode::<First, Second, Input> { first, second, phantom: PhantomData }
}
@@ -57,7 +57,7 @@ pub struct AsyncComposeNode<First, Second, I> {
}
#[cfg(feature = "alloc")]
impl<'i, 'f: 'i, 's: 'i, Input: 'static, First, Second> Node<'i, Input> for AsyncComposeNode<First, Second, Input>
impl<'i, Input: 'static, First, Second> Node<'i, Input> for AsyncComposeNode<First, Second, Input>
where
First: Node<'i, Input>,
First::Output: core::future::Future,

View File

@@ -708,7 +708,7 @@ pub struct StrokePathIter<'a> {
done_one: bool,
}
impl<'a> Iterator for StrokePathIter<'a> {
impl Iterator for StrokePathIter<'_> {
type Item = bezier_rs::Subpath<PointId>;
fn next(&mut self) -> Option<Self::Item> {