Fix clippy lints (#1327)

* Fix clippy lints

* Update formatting

* Remove unsafe send impls

* New type for Rc<NodeContainer>
This commit is contained in:
0HyperCube
2023-07-19 16:38:23 +01:00
committed by Keavon Chambers
parent 743803ce04
commit 80cc5bee73
80 changed files with 549 additions and 445 deletions
@@ -202,13 +202,15 @@ impl<'a> ModifyInputsContext<'a> {
let NodeInput::Value {
tagged_value: TaggedValue::Subpaths(subpaths),
..
} = subpaths else {
} = subpaths
else {
return;
};
let NodeInput::Value {
tagged_value: TaggedValue::ManipulatorGroupIds(mirror_angle_groups),
..
} = mirror_angle_groups else {
} = mirror_angle_groups
else {
return;
};
@@ -375,7 +375,7 @@ impl NodeGraphMessageHandler {
continue;
}
for (input_index, input) in node.inputs.iter_mut().enumerate() {
let NodeInput::Node{ node_id, .. } = input else {
let NodeInput::Node { node_id, .. } = input else {
continue;
};
if *node_id != deleting_node_id {
@@ -383,9 +383,9 @@ impl NodeGraphMessageHandler {
}
let Some(node_type) = document_node_types::resolve_document_node_type(&node.name) else {
warn!("Removing input of invalid node type '{}'", node.name);
return false;
};
warn!("Removing input of invalid node type '{}'", node.name);
return false;
};
if let NodeInput::Value { tagged_value, .. } = &node_type.inputs[input_index].default {
*input = NodeInput::value(tagged_value.clone(), true);
}
@@ -444,12 +444,12 @@ impl MessageHandler<NodeGraphMessage, (&mut Document, &NodeGraphExecutor, u64)>
let Some(network) = self.get_active_network(document) else {
error!("No network");
return;
};
};
let Some(input_node) = network.nodes.get(&input_node) else {
error!("No to");
return;
};
let Some((input_index, _)) = input_node.inputs.iter().enumerate().filter(|input|input.1.is_exposed()).nth(input_node_connector_index) else {
let Some((input_index, _)) = input_node.inputs.iter().enumerate().filter(|input| input.1.is_exposed()).nth(input_node_connector_index) else {
error!("Failed to find actual index of connector index {input_node_connector_index} on node {input_node:#?}");
return;
};
@@ -482,7 +482,10 @@ impl MessageHandler<NodeGraphMessage, (&mut Document, &NodeGraphExecutor, u64)>
let node_id = node_id.unwrap_or_else(crate::application::generate_uuid);
let Some(document_node_type) = document_node_types::resolve_document_node_type(&node_type) else {
responses.add(DialogMessage::DisplayDialogError { title: "Cannot insert node".to_string(), description: format!("The document node '{node_type}' does not exist in the document node list") });
responses.add(DialogMessage::DisplayDialogError {
title: "Cannot insert node".to_string(),
description: format!("The document node '{node_type}' does not exist in the document node list"),
});
return;
};
@@ -1051,7 +1051,11 @@ pub fn imaginate_properties(document_node: &DocumentNode, node_id: NodeId, conte
LayoutGroup::Row { widgets }.with_tooltip("Connection status to the server that computes generated images")
};
let &NodeInput::Value {tagged_value: TaggedValue::ImaginateController(ref controller),..} = controller else {
let &NodeInput::Value {
tagged_value: TaggedValue::ImaginateController(ref controller),
..
} = controller
else {
panic!("Invalid output status input")
};
let imaginate_status = controller.get_status();
@@ -1085,7 +1089,7 @@ pub fn imaginate_properties(document_node: &DocumentNode, node_id: NodeId, conte
})
};
let image_controls: _ = {
let image_controls = {
let mut widgets = vec![WidgetHolder::text_widget("Image"), WidgetHolder::unrelated_separator()];
let assist_separators = [
WidgetHolder::unrelated_separator(), // TODO: These three separators add up to 24px,
@@ -98,12 +98,8 @@ pub fn register_artboard_layer_properties(layer: &Layer, responses: &mut VecDequ
}];
let properties_body = {
let LayerDataType::Shape(shape) = &layer.data else {
panic!("Artboards can only be shapes")
};
let Fill::Solid(color) = shape.style.fill() else {
panic!("Artboard must have a solid fill")
};
let LayerDataType::Shape(shape) = &layer.data else { panic!("Artboards can only be shapes") };
let Fill::Solid(color) = shape.style.fill() else { panic!("Artboard must have a solid fill") };
let render_data = RenderData::new(&persistent_data.font_cache, ViewMode::default(), None);
let pivot = layer.transform.transform_vector2(layer.layerspace_pivot(&render_data));
@@ -21,5 +21,5 @@ where
V: Deserialize<'de>,
{
let container: Vec<_> = serde::Deserialize::deserialize(deserializer)?;
Ok(T::from_iter(container.into_iter()))
Ok(T::from_iter(container))
}