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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 694 additions and 456 deletions

1035
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -468,7 +468,7 @@ struct BitVectorIter<'a, const LENGTH: usize> {
iter_index: usize, iter_index: usize,
} }
impl<'a, const LENGTH: usize> Iterator for BitVectorIter<'a, LENGTH> { impl<const LENGTH: usize> Iterator for BitVectorIter<'_, LENGTH> {
type Item = usize; type Item = usize;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {

View file

@ -2144,7 +2144,7 @@ impl<'a> ClickXRayIter<'a> {
}; };
let get_clip = || path.iter().map(segment); let get_clip = || path.iter().map(segment);
let intersects = click_targets.map_or(false, |targets| targets.iter().any(|target| target.intersect_path(get_clip, transform))); let intersects = click_targets.is_some_and(|targets| targets.iter().any(|target| target.intersect_path(get_clip, transform)));
let clicked = intersects; let clicked = intersects;
let mut use_children = !clip || intersects; let mut use_children = !clip || intersects;
@ -2179,7 +2179,7 @@ impl<'a> ClickXRayIter<'a> {
match target { match target {
// Single points are much cheaper than paths so have their own special case // Single points are much cheaper than paths so have their own special case
XRayTarget::Point(point) => { XRayTarget::Point(point) => {
let intersects = click_targets.map_or(false, |targets| targets.iter().any(|target| target.intersect_point(*point, transform))); let intersects = click_targets.is_some_and(|targets| targets.iter().any(|target| target.intersect_point(*point, transform)));
XRayResult { XRayResult {
clicked: intersects, clicked: intersects,
use_children: !clip || intersects, use_children: !clip || intersects,
@ -2256,7 +2256,7 @@ pub fn navigation_controls(ptz: &PTZ, navigation_handler: &NavigationMessageHand
] ]
} }
impl<'a> Iterator for ClickXRayIter<'a> { impl Iterator for ClickXRayIter<'_> {
type Item = LayerNodeIdentifier; type Item = LayerNodeIdentifier;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {

View file

@ -7,7 +7,7 @@ use crate::messages::prelude::*;
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
pub struct PropertiesPanelMessageHandler {} pub struct PropertiesPanelMessageHandler {}
impl<'a> MessageHandler<PropertiesPanelMessage, (&PersistentData, PropertiesPanelMessageHandlerData<'a>)> for PropertiesPanelMessageHandler { impl MessageHandler<PropertiesPanelMessage, (&PersistentData, PropertiesPanelMessageHandlerData<'_>)> for PropertiesPanelMessageHandler {
fn process_message(&mut self, message: PropertiesPanelMessage, responses: &mut VecDeque<Message>, (persistent_data, data): (&PersistentData, PropertiesPanelMessageHandlerData)) { fn process_message(&mut self, message: PropertiesPanelMessage, responses: &mut VecDeque<Message>, (persistent_data, data): (&PersistentData, PropertiesPanelMessageHandlerData)) {
let PropertiesPanelMessageHandlerData { let PropertiesPanelMessageHandlerData {
network_interface, network_interface,

View file

@ -396,7 +396,7 @@ pub struct AxisIter<'a> {
pub metadata: &'a DocumentMetadata, pub metadata: &'a DocumentMetadata,
} }
impl<'a> Iterator for AxisIter<'a> { impl Iterator for AxisIter<'_> {
type Item = LayerNodeIdentifier; type Item = LayerNodeIdentifier;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
@ -417,7 +417,7 @@ pub struct DescendantsIter<'a> {
metadata: &'a DocumentMetadata, metadata: &'a DocumentMetadata,
} }
impl<'a> Iterator for DescendantsIter<'a> { impl Iterator for DescendantsIter<'_> {
type Item = LayerNodeIdentifier; type Item = LayerNodeIdentifier;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
@ -435,7 +435,7 @@ impl<'a> Iterator for DescendantsIter<'a> {
} }
} }
} }
impl<'a> DoubleEndedIterator for DescendantsIter<'a> { impl DoubleEndedIterator for DescendantsIter<'_> {
fn next_back(&mut self) -> Option<Self::Item> { fn next_back(&mut self) -> Option<Self::Item> {
if self.front == self.back { if self.front == self.back {
self.front = None; self.front = None;

View file

@ -1534,7 +1534,7 @@ impl NodeNetworkInterface {
Some(parent_metadata) Some(parent_metadata)
} }
/// Mutably get the node which encapsulates the currently viewed network. Will always be None in the document network. // /// Mutably get the node which encapsulates the currently viewed network. Will always be None in the document network.
// fn encapsulating_node_mut(&mut self, network_path: &[NodeId]) -> Option<&mut DocumentNode> { // fn encapsulating_node_mut(&mut self, network_path: &[NodeId]) -> Option<&mut DocumentNode> {
// let mut encapsulating_path = network_path.to_vec(); // let mut encapsulating_path = network_path.to_vec();
// let encapsulating_node_id = encapsulating_path.pop()?; // let encapsulating_node_id = encapsulating_path.pop()?;
@ -3887,7 +3887,7 @@ impl NodeNetworkInterface {
network_metadata.persistent_metadata.previewing = Previewing::No; network_metadata.persistent_metadata.previewing = Previewing::No;
} }
/// Sets the root node only if a node is being previewed // /// Sets the root node only if a node is being previewed
// pub fn update_root_node(&mut self, node_id: NodeId, output_index: usize) { // pub fn update_root_node(&mut self, node_id: NodeId, output_index: usize) {
// if let Previewing::Yes { root_node_to_restore } = self.previewing { // if let Previewing::Yes { root_node_to_restore } = self.previewing {
// // Only continue previewing if the new root node is not the same as the primary export. If it is the same, end the preview // // Only continue previewing if the new root node is not the same as the primary export. If it is the same, end the preview
@ -5148,14 +5148,13 @@ pub enum FlowType {
/// - [`FlowType::PrimaryFlow`]: iterates along the horizontal inputs of nodes, so in the case of a node chain `a -> b -> c`, this would yield `c, b, a` if we started from `c`. /// - [`FlowType::PrimaryFlow`]: iterates along the horizontal inputs of nodes, so in the case of a node chain `a -> b -> c`, this would yield `c, b, a` if we started from `c`.
/// - [`FlowType::HorizontalFlow`]: iterates over the secondary input for layer nodes and primary input for non layer nodes. /// - [`FlowType::HorizontalFlow`]: iterates over the secondary input for layer nodes and primary input for non layer nodes.
/// - [`FlowType::LayerChildrenUpstreamFlow`]: iterates over all upstream nodes from the secondary input of the node. /// - [`FlowType::LayerChildrenUpstreamFlow`]: iterates over all upstream nodes from the secondary input of the node.
struct FlowIter<'a> { struct FlowIter<'a> {
stack: Vec<NodeId>, stack: Vec<NodeId>,
network: &'a NodeNetwork, network: &'a NodeNetwork,
network_metadata: &'a NodeNetworkMetadata, network_metadata: &'a NodeNetworkMetadata,
flow_type: FlowType, flow_type: FlowType,
} }
impl<'a> Iterator for FlowIter<'a> { impl Iterator for FlowIter<'_> {
type Item = NodeId; type Item = NodeId;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
loop { loop {

View file

@ -463,7 +463,7 @@ impl ShapeState {
.selected_shape_state .selected_shape_state
.iter() .iter()
.map(|(&layer, selection_state)| (network_interface.compute_modified_vector(layer), selection_state)) .map(|(&layer, selection_state)| (network_interface.compute_modified_vector(layer), selection_state))
.flat_map(|(data, selection_state)| selection_state.selected_points.iter().map(move |&point| data.as_ref().map_or(false, |data| data.colinear(point)))); .flat_map(|(data, selection_state)| selection_state.selected_points.iter().map(move |&point| data.as_ref().is_some_and(|data| data.colinear(point))));
let Some(first_is_colinear) = points_colinear_status.next() else { return ManipulatorAngle::Mixed }; let Some(first_is_colinear) = points_colinear_status.next() else { return ManipulatorAngle::Mixed };
if points_colinear_status.any(|point| first_is_colinear != point) { if points_colinear_status.any(|point| first_is_colinear != point) {

View file

@ -253,7 +253,7 @@ impl Fsm for GradientToolFsmState {
let Some(gradient) = get_gradient(layer, &document.network_interface) else { continue }; let Some(gradient) = get_gradient(layer, &document.network_interface) else { continue };
let transform = gradient_space_transform(layer, document); let transform = gradient_space_transform(layer, document);
let dragging = selected let dragging = selected
.filter(|selected| selected.layer.map_or(false, |selected_layer| selected_layer == layer)) .filter(|selected| selected.layer.is_some_and(|selected_layer| selected_layer == layer))
.map(|selected| selected.dragging); .map(|selected| selected.dragging);
let Gradient { start, end, stops, .. } = gradient; let Gradient { start, end, stops, .. } = gradient;

View file

@ -446,7 +446,7 @@ impl PathToolData {
// Check if the toggle_colinear key has just been pressed // Check if the toggle_colinear key has just been pressed
if toggle_colinear && !self.toggle_colinear_debounce { if toggle_colinear && !self.toggle_colinear_debounce {
self.opposing_handle_lengths = None; self.opposing_handle_lengths = None;
let colinear = self.selection_status.angle().map_or(false, |angle| match angle { let colinear = self.selection_status.angle().is_some_and(|angle| match angle {
ManipulatorAngle::Colinear => true, ManipulatorAngle::Colinear => true,
ManipulatorAngle::Free => false, ManipulatorAngle::Free => false,
ManipulatorAngle::Mixed => false, ManipulatorAngle::Mixed => false,

View file

@ -40,7 +40,7 @@ impl TransformLayerMessageHandler {
} }
type TransformData<'a> = (&'a DocumentMessageHandler, &'a InputPreprocessorMessageHandler, &'a ToolData, &'a mut ShapeState); type TransformData<'a> = (&'a DocumentMessageHandler, &'a InputPreprocessorMessageHandler, &'a ToolData, &'a mut ShapeState);
impl<'a> MessageHandler<TransformLayerMessage, TransformData<'a>> for TransformLayerMessageHandler { impl MessageHandler<TransformLayerMessage, TransformData<'_>> for TransformLayerMessageHandler {
fn process_message(&mut self, message: TransformLayerMessage, responses: &mut VecDeque<Message>, (document, input, tool_data, shape_editor): TransformData) { fn process_message(&mut self, message: TransformLayerMessage, responses: &mut VecDeque<Message>, (document, input, tool_data, shape_editor): TransformData) {
let using_path_tool = tool_data.active_tool_type == ToolType::Path; let using_path_tool = tool_data.active_tool_type == ToolType::Path;

View file

@ -75,3 +75,6 @@ wasm-opt = ["-Os", "-g"]
debug-js-glue = true debug-js-glue = true
demangle-name-section = true demangle-name-section = true
dwarf-debug-info = true dwarf-debug-info = true
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] }

View file

@ -26,8 +26,8 @@ use std::sync::atomic::Ordering;
use std::time::Duration; use std::time::Duration;
use wasm_bindgen::prelude::*; use wasm_bindgen::prelude::*;
/// We directly interface with the updateImage JS function for massively increased performance over serializing and deserializing. // /// We directly interface with the updateImage JS function for massively increased performance over serializing and deserializing.
/// This avoids creating a json with a list millions of numbers long. // /// This avoids creating a json with a list millions of numbers long.
// #[wasm_bindgen(module = "/../src/wasm-communication/editor.ts")] // #[wasm_bindgen(module = "/../src/wasm-communication/editor.ts")]
// extern "C" { // extern "C" {
// // fn dispatchTauri(message: String) -> String; // // fn dispatchTauri(message: String) -> String;

View file

@ -191,7 +191,7 @@ impl SymmetricalBasis {
} }
// https://gitlab.com/inkscape/lib2geom/-/blob/master/src/2geom/sbasis.cpp#L228 // https://gitlab.com/inkscape/lib2geom/-/blob/master/src/2geom/sbasis.cpp#L228
impl<'a> std::ops::Mul for &'a SymmetricalBasis { impl std::ops::Mul for &SymmetricalBasis {
type Output = SymmetricalBasis; type Output = SymmetricalBasis;
fn mul(self, b: Self) -> Self::Output { fn mul(self, b: Self) -> Self::Output {
let a = self; let a = self;

View file

@ -34,7 +34,6 @@ use syn::{parse_macro_input, DeriveInput, GenericParam, Lifetime, LifetimeParam,
/// // } /// // }
/// ///
/// ``` /// ```
#[proc_macro_derive(DynAny, attributes(dyn_any_derive))] #[proc_macro_derive(DynAny, attributes(dyn_any_derive))]
pub fn system_desc_derive(input: TokenStream) -> TokenStream { pub fn system_desc_derive(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput); let ast = parse_macro_input!(input as DeriveInput);

View file

@ -145,7 +145,7 @@ macro_rules! impl_type {
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
unsafe impl<'a, T: StaticTypeClone + Clone> StaticType for Cow<'a, T> { unsafe impl<T: StaticTypeClone + Clone> StaticType for Cow<'_, T> {
type Static = Cow<'static, <T as StaticTypeClone>::Static>; type Static = Cow<'static, <T as StaticTypeClone>::Static>;
} }
unsafe impl<T: StaticTypeSized> StaticType for *const [T] { unsafe impl<T: StaticTypeSized> StaticType for *const [T] {
@ -173,11 +173,11 @@ mod slice {
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
unsafe impl<'a, T: StaticTypeSized> StaticType for Box<dyn Iterator<Item = T> + 'a + Send + Sync> { unsafe impl<T: StaticTypeSized> StaticType for Box<dyn Iterator<Item = T> + '_ + Send + Sync> {
type Static = Box<dyn Iterator<Item = <T as StaticTypeSized>::Static> + Send + Sync>; type Static = Box<dyn Iterator<Item = <T as StaticTypeSized>::Static> + Send + Sync>;
} }
unsafe impl<'a> StaticType for &'a str { unsafe impl StaticType for &str {
type Static = &'static str; type Static = &'static str;
} }
unsafe impl StaticType for () { unsafe impl StaticType for () {

View file

@ -9,7 +9,7 @@ macro_rules! generate_benchmarks {
$( $(
c.bench_function(concat!("parse ", $input), |b| { c.bench_function(concat!("parse ", $input), |b| {
b.iter(|| { b.iter(|| {
let _ = black_box(ast::Node::from_str($input)).unwrap(); let _ = black_box(ast::Node::try_parse_from_str($input)).unwrap();
}); });
}); });
)* )*
@ -17,7 +17,7 @@ macro_rules! generate_benchmarks {
fn evaluation_bench(c: &mut Criterion) { fn evaluation_bench(c: &mut Criterion) {
$( $(
let expr = ast::Node::from_str($input).unwrap().0; let expr = ast::Node::try_parse_from_str($input).unwrap().0;
let context = EvalContext::default(); let context = EvalContext::default();
c.bench_function(concat!("eval ", $input), |b| { c.bench_function(concat!("eval ", $input), |b| {

View file

@ -4,9 +4,10 @@ use lazy_static::lazy_static;
use num_complex::{Complex, ComplexFloat}; use num_complex::{Complex, ComplexFloat};
use crate::value::{Number, Value}; use crate::value::{Number, Value};
type FunctionImplementation = Box<dyn Fn(&[Value]) -> Option<Value> + Send + Sync>;
lazy_static! { lazy_static! {
pub static ref DEFAULT_FUNCTIONS: HashMap<&'static str, Box<dyn Fn(&[Value]) -> Option<Value> + Send + Sync>> = { pub static ref DEFAULT_FUNCTIONS: HashMap<&'static str, FunctionImplementation> = {
let mut map: HashMap<&'static str, Box<dyn Fn(&[Value]) -> Option<Value> + Send + Sync>> = HashMap::new(); let mut map: HashMap<&'static str, FunctionImplementation> = HashMap::new();
map.insert( map.insert(
"sin", "sin",

View file

@ -14,7 +14,7 @@ use parser::ParseError;
use value::Value; use value::Value;
pub fn evaluate(expression: &str) -> Result<(Result<Value, EvalError>, Unit), ParseError> { pub fn evaluate(expression: &str) -> Result<(Result<Value, EvalError>, Unit), ParseError> {
let expr = ast::Node::from_str(expression); let expr = ast::Node::try_parse_from_str(expression);
let context = EvalContext::default(); let context = EvalContext::default();
expr.map(|(node, unit)| (node.eval(&context), unit)) expr.map(|(node, unit)| (node.eval(&context), unit))
} }
@ -37,7 +37,7 @@ mod tests {
let expected_value = $expected_value; let expected_value = $expected_value;
let expected_unit = $expected_unit; let expected_unit = $expected_unit;
let expr = ast::Node::from_str($input); let expr = ast::Node::try_parse_from_str($input);
let context = EvalContext::default(); let context = EvalContext::default();
let (actual_value, actual_unit) = expr.map(|(node, unit)| (node.eval(&context), unit)).unwrap(); let (actual_value, actual_unit) = expr.map(|(node, unit)| (node.eval(&context), unit)).unwrap();

View file

@ -56,7 +56,7 @@ pub enum ParseError {
} }
impl Node { impl Node {
pub fn from_str(s: &str) -> Result<(Node, Unit), ParseError> { pub fn try_parse_from_str(s: &str) -> Result<(Node, Unit), ParseError> {
let pairs = ExprParser::parse(Rule::program, s).map_err(Box::new)?; let pairs = ExprParser::parse(Rule::program, s).map_err(Box::new)?;
let (node, metadata) = parse_expr(pairs)?; let (node, metadata) = parse_expr(pairs)?;
Ok((node, metadata.unit)) Ok((node, metadata.unit))
@ -325,7 +325,7 @@ mod tests {
$( $(
#[test] #[test]
fn $name() { fn $name() {
let result = Node::from_str($input).unwrap(); let result = Node::try_parse_from_str($input).unwrap();
assert_eq!(result.0, $expected); assert_eq!(result.0, $expected);
} }
)* )*
@ -334,7 +334,7 @@ mod tests {
test_parser! { test_parser! {
test_parse_int_literal: "42" => Node::Lit(Literal::Float(42.0)), test_parse_int_literal: "42" => Node::Lit(Literal::Float(42.0)),
test_parse_float_literal: "3.14" => Node::Lit(Literal::Float(3.14)), test_parse_float_literal: "3.14" => Node::Lit(Literal::Float(#[allow(clippy::approx_constant)] 3.14)),
test_parse_ident: "x" => Node::Var("x".to_string()), test_parse_ident: "x" => Node::Var("x".to_string()),
test_parse_unary_neg: "-42" => Node::UnaryOp { test_parse_unary_neg: "-42" => Node::UnaryOp {
expr: Box::new(Node::Lit(Literal::Float(42.0))), expr: Box::new(Node::Lit(Literal::Float(42.0))),

View file

@ -1103,7 +1103,7 @@ impl RenderSvgSegmentList for Vec<SvgSegment> {
pub struct SvgRenderAttrs<'a>(&'a mut SvgRender); 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)) { pub fn push_complex(&mut self, name: impl Into<SvgSegment>, value: impl FnOnce(&mut SvgRender)) {
self.0.svg.push(" ".into()); self.0.svg.push(" ".into());
self.0.svg.push(name.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; type Output = N::Output;
fn eval(&'i self, input: I) -> N::Output { fn eval(&'i self, input: I) -> N::Output {
(*self).eval(input) (*self).eval(input)
} }
} }
#[cfg(feature = "alloc")] #[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; type Output = O;
fn eval(&'i self, input: I) -> O { fn eval(&'i self, input: I) -> O {
(**self).eval(input) (**self).eval(input)
} }
} }
#[cfg(feature = "alloc")] #[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; type Output = O;
fn eval(&'i self, input: I) -> O { fn eval(&'i self, input: I) -> O {
(**self).eval(input) (**self).eval(input)

View file

@ -15,7 +15,7 @@ pub struct MemoNode<T, CachedNode> {
cache: Arc<Mutex<Option<(u64, T)>>>, cache: Arc<Mutex<Option<(u64, T)>>>,
node: CachedNode, 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 where
CachedNode: for<'any_input> Node<'any_input, I>, CachedNode: for<'any_input> Node<'any_input, I>,
for<'a> <CachedNode as Node<'a, I>>::Output: core::future::Future<Output = T> + WasmNotSend, 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>, _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 where
CachedNode: for<'any_input> Node<'any_input, I>, CachedNode: for<'any_input> Node<'any_input, I>,
for<'a> <CachedNode as Node<'a, I>>::Output: core::future::Future<Output = T> + WasmNotSend, 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>, 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) { fn drop(&mut self) {
let hash = MemoHash::<T>::calc_hash(&self.inner.value); let hash = MemoHash::<T>::calc_hash(&self.inner.value);
self.inner.hash = hash; 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; type Target = T;
fn deref(&self) -> &Self::Target { 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 { fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner.value &mut self.inner.value
} }

View file

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

View file

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

View file

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

View file

@ -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) { // 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 }; // self.exports[export_index] = NodeInput::Node { node_id, output_index, lambda };
// let input_source = &mut node.original_location.inputs_source; // let input_source = &mut node.original_location.inputs_source;

View file

@ -26,7 +26,7 @@ pub struct ComposeTypeErased {
second: SharedNodeContainer, 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>>; type Output = DynFuture<'i, Any<'i>>;
fn eval(&'i self, input: Any<'i>) -> Self::Output { fn eval(&'i self, input: Any<'i>) -> Self::Output {
Box::pin(async move { Box::pin(async move {

View file

@ -333,7 +333,7 @@ pub async fn imaginate<'a, P: Pixel>(
#[cfg(all(feature = "imaginate", feature = "serde"))] #[cfg(all(feature = "imaginate", feature = "serde"))]
#[allow(clippy::too_many_arguments)] #[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>, image: Image<P>,
host_name: &str, host_name: &str,
set_progress: F, set_progress: F,

View file

@ -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>>> { fn execute(&self, input: I) -> LocalFuture<Result<TaggedValue, Box<dyn Error>>> {
Box::pin(async move { Box::pin(async move {
use futures::FutureExt; use futures::FutureExt;

View file

@ -426,7 +426,7 @@ fn parse_node_type(ty: &Type) -> (bool, Option<Type>, Option<Type>) {
if let Type::ImplTrait(impl_trait) = ty { if let Type::ImplTrait(impl_trait) = ty {
for bound in &impl_trait.bounds { for bound in &impl_trait.bounds {
if let syn::TypeParamBound::Trait(trait_bound) = bound { 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 { 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 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| { let output_type = args.args.iter().find_map(|arg| {

View file

@ -7,7 +7,7 @@ fn parse_hint_helper_attrs(attrs: &[Attribute]) -> syn::Result<(Vec<LitStr>, Vec
fold_error_iter( fold_error_iter(
attrs attrs
.iter() .iter()
.filter(|a| a.path().get_ident().map_or(false, |i| i == "hint")) .filter(|a| a.path().get_ident().is_some_and(|i| i == "hint"))
.map(|attr| attr.parse_args::<AttrInnerKeyStringMap>()), .map(|attr| attr.parse_args::<AttrInnerKeyStringMap>()),
) )
.and_then(|v: Vec<AttrInnerKeyStringMap>| { .and_then(|v: Vec<AttrInnerKeyStringMap>| {

View file

@ -43,3 +43,6 @@ wasm-opt = ["-Oz", "--enable-bulk-memory"]
debug-js-glue = false debug-js-glue = false
demangle-name-section = false demangle-name-section = false
dwarf-debug-info = false dwarf-debug-info = false
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] }