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
@@ -2144,7 +2144,7 @@ impl<'a> ClickXRayIter<'a> {
};
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 mut use_children = !clip || intersects;
@@ -2179,7 +2179,7 @@ impl<'a> ClickXRayIter<'a> {
match target {
// Single points are much cheaper than paths so have their own special case
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 {
clicked: 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;
fn next(&mut self) -> Option<Self::Item> {
@@ -7,7 +7,7 @@ use crate::messages::prelude::*;
#[derive(Debug, Clone, Default)]
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)) {
let PropertiesPanelMessageHandlerData {
network_interface,
@@ -396,7 +396,7 @@ pub struct AxisIter<'a> {
pub metadata: &'a DocumentMetadata,
}
impl<'a> Iterator for AxisIter<'a> {
impl Iterator for AxisIter<'_> {
type Item = LayerNodeIdentifier;
fn next(&mut self) -> Option<Self::Item> {
@@ -417,7 +417,7 @@ pub struct DescendantsIter<'a> {
metadata: &'a DocumentMetadata,
}
impl<'a> Iterator for DescendantsIter<'a> {
impl Iterator for DescendantsIter<'_> {
type Item = LayerNodeIdentifier;
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> {
if self.front == self.back {
self.front = None;
@@ -1534,7 +1534,7 @@ impl NodeNetworkInterface {
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> {
// let mut encapsulating_path = network_path.to_vec();
// let encapsulating_node_id = encapsulating_path.pop()?;
@@ -3887,7 +3887,7 @@ impl NodeNetworkInterface {
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) {
// 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
@@ -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::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.
struct FlowIter<'a> {
stack: Vec<NodeId>,
network: &'a NodeNetwork,
network_metadata: &'a NodeNetworkMetadata,
flow_type: FlowType,
}
impl<'a> Iterator for FlowIter<'a> {
impl Iterator for FlowIter<'_> {
type Item = NodeId;
fn next(&mut self) -> Option<Self::Item> {
loop {