mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 01:08:11 +08:00
Fix clippy lints (#2119)
This commit is contained in:
@@ -468,7 +468,7 @@ struct BitVectorIter<'a, const LENGTH: 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;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
||||
@@ -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> {
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
@@ -463,7 +463,7 @@ impl ShapeState {
|
||||
.selected_shape_state
|
||||
.iter()
|
||||
.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 };
|
||||
if points_colinear_status.any(|point| first_is_colinear != point) {
|
||||
|
||||
@@ -253,7 +253,7 @@ impl Fsm for GradientToolFsmState {
|
||||
let Some(gradient) = get_gradient(layer, &document.network_interface) else { continue };
|
||||
let transform = gradient_space_transform(layer, document);
|
||||
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);
|
||||
|
||||
let Gradient { start, end, stops, .. } = gradient;
|
||||
|
||||
@@ -446,7 +446,7 @@ impl PathToolData {
|
||||
// Check if the toggle_colinear key has just been pressed
|
||||
if toggle_colinear && !self.toggle_colinear_debounce {
|
||||
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::Free => false,
|
||||
ManipulatorAngle::Mixed => false,
|
||||
|
||||
@@ -40,7 +40,7 @@ impl TransformLayerMessageHandler {
|
||||
}
|
||||
|
||||
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) {
|
||||
let using_path_tool = tool_data.active_tool_type == ToolType::Path;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user