mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-09-09 22:46:16 +00:00
Fix clippy lints (#2119)
This commit is contained in:
parent
00629571f2
commit
e3bb11ec1b
32 changed files with 694 additions and 456 deletions
|
@ -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());
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -1190,7 +1190,7 @@ impl NodeNetwork {
|
|||
}
|
||||
}
|
||||
|
||||
/// Locate the export that is a [`NodeInput::Network`] at index `offset` and replace it with a [`NodeInput::Node`].
|
||||
// /// Locate the export that is a [`NodeInput::Network`] at index `offset` and replace it with a [`NodeInput::Node`].
|
||||
// fn populate_first_network_export(&mut self, node: &mut DocumentNode, node_id: NodeId, output_index: usize, lambda: bool, export_index: usize, source: impl Iterator<Item = Source>, skip: usize) {
|
||||
// self.exports[export_index] = NodeInput::Node { node_id, output_index, lambda };
|
||||
// let input_source = &mut node.original_location.inputs_source;
|
||||
|
|
|
@ -26,7 +26,7 @@ pub struct ComposeTypeErased {
|
|||
second: SharedNodeContainer,
|
||||
}
|
||||
|
||||
impl<'i, 'a: 'i> Node<'i, Any<'i>> for ComposeTypeErased {
|
||||
impl<'i> Node<'i, Any<'i>> for ComposeTypeErased {
|
||||
type Output = DynFuture<'i, Any<'i>>;
|
||||
fn eval(&'i self, input: Any<'i>) -> Self::Output {
|
||||
Box::pin(async move {
|
||||
|
|
|
@ -333,7 +333,7 @@ pub async fn imaginate<'a, P: Pixel>(
|
|||
|
||||
#[cfg(all(feature = "imaginate", feature = "serde"))]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn imaginate_maybe_fail<'a, P: Pixel, F: Fn(ImaginateStatus)>(
|
||||
async fn imaginate_maybe_fail<P: Pixel, F: Fn(ImaginateStatus)>(
|
||||
image: Image<P>,
|
||||
host_name: &str,
|
||||
set_progress: F,
|
||||
|
|
|
@ -114,7 +114,7 @@ impl DynamicExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, I: StaticType + 'static + Send + Sync + std::panic::UnwindSafe> Executor<I, TaggedValue> for &'a DynamicExecutor {
|
||||
impl<I: StaticType + 'static + Send + Sync + std::panic::UnwindSafe> Executor<I, TaggedValue> for &DynamicExecutor {
|
||||
fn execute(&self, input: I) -> LocalFuture<Result<TaggedValue, Box<dyn Error>>> {
|
||||
Box::pin(async move {
|
||||
use futures::FutureExt;
|
||||
|
|
|
@ -426,7 +426,7 @@ fn parse_node_type(ty: &Type) -> (bool, Option<Type>, Option<Type>) {
|
|||
if let Type::ImplTrait(impl_trait) = ty {
|
||||
for bound in &impl_trait.bounds {
|
||||
if let syn::TypeParamBound::Trait(trait_bound) = bound {
|
||||
if trait_bound.path.segments.last().map_or(false, |seg| seg.ident == "Node") {
|
||||
if trait_bound.path.segments.last().is_some_and(|seg| seg.ident == "Node") {
|
||||
if let syn::PathArguments::AngleBracketed(args) = &trait_bound.path.segments.last().unwrap().arguments {
|
||||
let input_type = args.args.iter().find_map(|arg| if let syn::GenericArgument::Type(ty) = arg { Some(ty.clone()) } else { None });
|
||||
let output_type = args.args.iter().find_map(|arg| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue