Fix a lot of Clippy warnings (#1808)

* fix a lot of clippy warnings

* fix more clippy warnings

* fix yet more clippy warnings

* bump msrv to 1.70.0 to silence warnings

* fix a lot of clippy warnings

* fix more clippy warnings

* fix yet more clippy warnings

* fix a few more warnings

* fix a clippy warning

* remove a commented out line

* silense too many arguments error

* fix more clippy warnings

* prefix underscore to unused vars/functions to fix warnings

* use filter instead of map

* move raw-rs-tests feature flat to module level to fix unused imports warnings

* fix a couple of unused result warnings

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Raminder Singh
2024-07-09 05:02:52 -07:00
committed by GitHub
co-authored by Keavon Chambers
parent f7ada701e5
commit 62f73df048
49 changed files with 264 additions and 260 deletions
@@ -507,14 +507,14 @@ impl ShapeState {
};
// Set the manipulator to have colinear handles
if let (Some(a), Some(b)) = (handles.get(0), handles.get(1)) {
if let (Some(a), Some(b)) = (handles.first(), handles.get(1)) {
let handles = [*a, *b];
let modification_type = VectorModificationType::SetG1Continuous { handles, enabled: true };
responses.add(GraphOperationMessage::Vector { layer, modification_type });
}
// Flip the vector if it is not facing towards the same direction as the anchor
let [first, second] = [anchor_positions.get(0).copied().flatten(), anchor_positions.get(1).copied().flatten()];
let [first, second] = [anchor_positions.first().copied().flatten(), anchor_positions.get(1).copied().flatten()];
if first.is_some_and(|group| (group - anchor_position).normalize_or_zero().dot(handle_direction) < 0.)
|| second.is_some_and(|group| (group - anchor_position).normalize_or_zero().dot(handle_direction) > 0.)
{
@@ -532,7 +532,7 @@ impl ShapeState {
responses.add(GraphOperationMessage::Vector { layer, modification_type });
// Create the opposite handle if it doesn't exist (if it is not a cubic segment)
if handle.opposite().to_manipulator_point().get_position(&vector_data).is_none() {
if handle.opposite().to_manipulator_point().get_position(vector_data).is_none() {
let modification_type = handle.opposite().set_relative_position(DVec2::ZERO);
responses.add(GraphOperationMessage::Vector { layer, modification_type });
}
@@ -784,7 +784,7 @@ impl ShapeState {
let mut handles = handles.map(Some);
for handle in &mut handles {
while let Some((point, connected)) = handle.clone().and_then(|(_, point)| missing_anchors.remove_entry(&point)) {
while let Some((point, connected)) = (*handle).and_then(|(_, point)| missing_anchors.remove_entry(&point)) {
visited.push(point);
*handle = connected.into_iter().find(|(_, point)| !visited.contains(point));
@@ -70,7 +70,7 @@ impl LayerSnapper {
for subpath in document.metadata.layer_outline(layer) {
for (start_index, curve) in subpath.iter().enumerate() {
let document_curve = curve.apply_transformation(|p| transform.transform_point2(p));
let start = subpath.manipulator_groups()[start_index].id.into();
let start = subpath.manipulator_groups()[start_index].id;
if snap_data.ignore_manipulator(layer, start) || snap_data.ignore_manipulator(layer, subpath.manipulator_groups()[(start_index + 1) % subpath.len()].id) {
continue;
}