Remove warnings from build and satisfied clippy (#1288)

* Prefixed unused functions with underscore

* Applied clippy lints

* Fixed some warnings and removed some `allow` statements
This commit is contained in:
Prikshit Gautam 2023-06-07 14:46:47 +05:30 committed by Keavon Chambers
parent 054acd3cc9
commit 70fcb35444
33 changed files with 54 additions and 60 deletions

View File

@ -168,8 +168,8 @@ impl NodeGraphMessageHandler {
fn collect_nested_addresses(&mut self, document: &Document, responses: &mut VecDeque<Message>) { fn collect_nested_addresses(&mut self, document: &Document, responses: &mut VecDeque<Message>) {
// // Build path list // // Build path list
let mut path = vec![]; let mut path = vec![];
if let Some(layer) = self.layer_path.as_ref().and_then(|path| document.layer(&path).ok()) { if let Some(layer) = self.layer_path.as_ref().and_then(|path| document.layer(path).ok()) {
path.push(format!("Layer: {}", layer.name.as_ref().map(|name| name.as_str()).unwrap_or("Untitled Layer"))); path.push(format!("Layer: {}", layer.name.as_deref().unwrap_or("Untitled Layer")));
} else { } else {
path.push("Document Network".to_string()); path.push("Document Network".to_string());
} }

View File

@ -1,3 +1,5 @@
#![allow(clippy::too_many_arguments)]
use super::document_node_types::NodePropertiesContext; use super::document_node_types::NodePropertiesContext;
use super::FrontendGraphDataType; use super::FrontendGraphDataType;
use crate::messages::layout::utility_types::widget_prelude::*; use crate::messages::layout::utility_types::widget_prelude::*;
@ -699,7 +701,7 @@ pub fn brightness_contrast_properties(document_node: &DocumentNode, node_id: Nod
] ]
} }
pub fn blur_image_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> { pub fn _blur_image_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
let radius = number_widget(document_node, node_id, 1, "Radius", NumberInput::default().min(0.).max(20.).int(), true); let radius = number_widget(document_node, node_id, 1, "Radius", NumberInput::default().min(0.).max(20.).int(), true);
let sigma = number_widget(document_node, node_id, 2, "Sigma", NumberInput::default().min(0.).max(10000.), true); let sigma = number_widget(document_node, node_id, 2, "Sigma", NumberInput::default().min(0.).max(10000.), true);
@ -869,7 +871,7 @@ pub fn adjust_selective_color_properties(document_node: &DocumentNode, node_id:
} }
#[cfg(feature = "gpu")] #[cfg(feature = "gpu")]
pub fn gpu_map_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> { pub fn _gpu_map_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
let map = text_widget(document_node, node_id, 1, "Map", true); let map = text_widget(document_node, node_id, 1, "Map", true);
vec![LayoutGroup::Row { widgets: map }] vec![LayoutGroup::Row { widgets: map }]

View File

@ -27,10 +27,10 @@ pub fn new_custom_layer(network: NodeNetwork, layer_path: Vec<LayerId>, response
responses.add(DocumentMessage::InputFrameRasterizeRegionBelowLayer { layer_path }); responses.add(DocumentMessage::InputFrameRasterizeRegionBelowLayer { layer_path });
} }
pub fn set_manipulator_mirror_angle(manipulator_groups: &Vec<ManipulatorGroup<ManipulatorGroupId>>, layer_path: &Vec<u64>, mirror_angle: bool, responses: &mut VecDeque<Message>) { pub fn set_manipulator_mirror_angle(manipulator_groups: &Vec<ManipulatorGroup<ManipulatorGroupId>>, layer_path: &[u64], mirror_angle: bool, responses: &mut VecDeque<Message>) {
for manipulator_group in manipulator_groups { for manipulator_group in manipulator_groups {
responses.add(GraphOperationMessage::Vector { responses.add(GraphOperationMessage::Vector {
layer: layer_path.clone(), layer: layer_path.to_owned(),
modification: VectorDataModification::SetManipulatorHandleMirroring { modification: VectorDataModification::SetManipulatorHandleMirroring {
id: manipulator_group.id, id: manipulator_group.id,
mirror_angle, mirror_angle,

View File

@ -123,7 +123,7 @@ impl OverlayRenderer {
responses.add(OverlaysMessage::Rerender); responses.add(OverlaysMessage::Rerender);
} }
pub fn clear_subpath_overlays(&mut self, document: &Document, layer_path: Vec<LayerId>, responses: &mut VecDeque<Message>) { pub fn clear_subpath_overlays(&mut self, _document: &Document, layer_path: Vec<LayerId>, responses: &mut VecDeque<Message>) {
let layer_id = layer_path.last().unwrap(); let layer_id = layer_path.last().unwrap();
// Remove the shape outline overlays // Remove the shape outline overlays

View File

@ -22,7 +22,7 @@ use graphene_core::Color;
use glam::DAffine2; use glam::DAffine2;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
const EXPOSED_BLEND_MODES: &'static [&'static [BlendMode]] = { const EXPOSED_BLEND_MODES: &[&[BlendMode]] = {
use BlendMode::*; use BlendMode::*;
&[ &[
// Basic group // Basic group

View File

@ -231,7 +231,7 @@ impl Fsm for EllipseToolFsmState {
let fill_color = tool_options.fill.active_color(); let fill_color = tool_options.fill.active_color();
responses.add(GraphOperationMessage::FillSet { responses.add(GraphOperationMessage::FillSet {
layer: layer_path.clone(), layer: layer_path.clone(),
fill: if fill_color.is_some() { Fill::Solid(fill_color.unwrap()) } else { Fill::None }, fill: if let Some(color) = fill_color { Fill::Solid(color) } else { Fill::None },
}); });
responses.add(GraphOperationMessage::StrokeSet { responses.add(GraphOperationMessage::StrokeSet {

View File

@ -293,7 +293,7 @@ fn add_polyline(data: &FreehandToolData, stroke_color: Option<Color>, fill_color
responses.add(GraphOperationMessage::FillSet { responses.add(GraphOperationMessage::FillSet {
layer: layer_path.clone(), layer: layer_path.clone(),
fill: if fill_color.is_some() { Fill::Solid(fill_color.unwrap()) } else { Fill::None }, fill: if let Some(color) = fill_color { Fill::Solid(color) } else { Fill::None },
}); });
responses.add(GraphOperationMessage::StrokeSet { responses.add(GraphOperationMessage::StrokeSet {

View File

@ -269,7 +269,7 @@ impl PenToolData {
responses.add(GraphOperationMessage::FillSet { responses.add(GraphOperationMessage::FillSet {
layer: layer_path.clone(), layer: layer_path.clone(),
fill: if fill_color.is_some() { Fill::Solid(fill_color.unwrap()) } else { Fill::None }, fill: if let Some(color) = fill_color { Fill::Solid(color) } else { Fill::None },
}); });
responses.add(GraphOperationMessage::StrokeSet { responses.add(GraphOperationMessage::StrokeSet {

View File

@ -226,7 +226,7 @@ impl Fsm for RectangleToolFsmState {
let fill_color = tool_options.fill.active_color(); let fill_color = tool_options.fill.active_color();
responses.add(GraphOperationMessage::FillSet { responses.add(GraphOperationMessage::FillSet {
layer: layer_path.clone(), layer: layer_path.clone(),
fill: if fill_color.is_some() { Fill::Solid(fill_color.unwrap()) } else { Fill::None }, fill: if let Some(color) = fill_color { Fill::Solid(color) } else { Fill::None },
}); });
responses.add(GraphOperationMessage::StrokeSet { responses.add(GraphOperationMessage::StrokeSet {

View File

@ -1,3 +1,4 @@
#![allow(clippy::too_many_arguments)]
use crate::application::generate_uuid; use crate::application::generate_uuid;
use crate::consts::{ROTATE_SNAP_ANGLE, SELECTION_TOLERANCE}; use crate::consts::{ROTATE_SNAP_ANGLE, SELECTION_TOLERANCE};
use crate::messages::frontend::utility_types::MouseCursorIcon; use crate::messages::frontend::utility_types::MouseCursorIcon;
@ -1219,7 +1220,7 @@ fn edit_layer_deepest_manipulation(intersect: &Layer, responses: &mut VecDeque<M
} }
} }
fn recursive_search(document: &DocumentMessageHandler, layer_path: &Vec<u64>, incoming_layer_path_vector: &Vec<u64>) -> bool { fn recursive_search(document: &DocumentMessageHandler, layer_path: &[u64], incoming_layer_path_vector: &Vec<u64>) -> bool {
let layer_paths = document.document_legacy.folder_children_paths(layer_path); let layer_paths = document.document_legacy.folder_children_paths(layer_path);
for path in layer_paths { for path in layer_paths {
if path == *incoming_layer_path_vector || document.document_legacy.is_folder(path.clone()) && recursive_search(document, &path, incoming_layer_path_vector) { if path == *incoming_layer_path_vector || document.document_legacy.is_folder(path.clone()) && recursive_search(document, &path, incoming_layer_path_vector) {

View File

@ -244,7 +244,7 @@ impl Fsm for ShapeToolFsmState {
let fill_color = tool_options.fill.active_color(); let fill_color = tool_options.fill.active_color();
responses.add(GraphOperationMessage::FillSet { responses.add(GraphOperationMessage::FillSet {
layer: layer_path.clone(), layer: layer_path.clone(),
fill: if fill_color.is_some() { Fill::Solid(fill_color.unwrap()) } else { Fill::None }, fill: if let Some(color) = fill_color { Fill::Solid(color) } else { Fill::None },
}); });
responses.add(GraphOperationMessage::StrokeSet { responses.add(GraphOperationMessage::StrokeSet {

View File

@ -339,7 +339,7 @@ fn add_spline(tool_data: &SplineToolData, show_preview: bool, fill_color: Option
responses.add(GraphOperationMessage::FillSet { responses.add(GraphOperationMessage::FillSet {
layer: layer_path.clone(), layer: layer_path.clone(),
fill: if fill_color.is_some() { Fill::Solid(fill_color.unwrap()) } else { Fill::None }, fill: if let Some(color) = fill_color { Fill::Solid(color) } else { Fill::None },
}); });
responses.add(GraphOperationMessage::StrokeSet { responses.add(GraphOperationMessage::StrokeSet {

View File

@ -1,3 +1,5 @@
#![allow(clippy::too_many_arguments)]
use crate::application::generate_uuid; use crate::application::generate_uuid;
use crate::consts::{COLOR_ACCENT, SELECTION_TOLERANCE}; use crate::consts::{COLOR_ACCENT, SELECTION_TOLERANCE};
use crate::messages::frontend::utility_types::MouseCursorIcon; use crate::messages::frontend::utility_types::MouseCursorIcon;
@ -209,7 +211,6 @@ impl ToolTransition for TextTool {
tool_abort: Some(TextToolMessage::Abort.into()), tool_abort: Some(TextToolMessage::Abort.into()),
selection_changed: Some(TextToolMessage::DocumentIsDirty.into()), selection_changed: Some(TextToolMessage::DocumentIsDirty.into()),
working_color_changed: Some(TextToolMessage::WorkingColorChanged.into()), working_color_changed: Some(TextToolMessage::WorkingColorChanged.into()),
..Default::default()
} }
} }
} }

View File

@ -1,3 +1,4 @@
#![allow(clippy::too_many_arguments)]
use super::common_functionality::overlay_renderer::OverlayRenderer; use super::common_functionality::overlay_renderer::OverlayRenderer;
use super::common_functionality::shape_editor::ShapeState; use super::common_functionality::shape_editor::ShapeState;
use super::tool_messages::*; use super::tool_messages::*;

View File

@ -38,11 +38,6 @@ pub struct NodeRuntime {
canvas_cache: HashMap<Vec<LayerId>, SurfaceId>, canvas_cache: HashMap<Vec<LayerId>, SurfaceId>,
} }
fn get_imaginate_index(name: &str) -> usize {
use crate::messages::portfolio::document::node_graph::IMAGINATE_NODE;
IMAGINATE_NODE.inputs.iter().position(|input| input.name == name).unwrap_or_else(|| panic!("Input {name} not found"))
}
enum NodeRuntimeMessage { enum NodeRuntimeMessage {
GenerationRequest(GenerationRequest), GenerationRequest(GenerationRequest),
FontCacheUpdate(FontCache), FontCacheUpdate(FontCache),

View File

@ -1,7 +1,7 @@
#![doc(html_root_url = "http://docs.rs/const-default/1.0.0")] #![doc(html_root_url = "http://docs.rs/const-default/1.0.0")]
#![cfg_attr(feature = "unstable-docs", feature(doc_cfg))] #![cfg_attr(feature = "unstable-docs", feature(doc_cfg))]
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::missing_safety_doc)]
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
extern crate alloc; extern crate alloc;

View File

@ -70,6 +70,5 @@ fn add_network() -> NodeNetwork {
.enumerate() .enumerate()
.map(|(i, n)| (i as u64, n)) .map(|(i, n)| (i as u64, n))
.collect(), .collect(),
..Default::default()
} }
} }

View File

@ -53,7 +53,7 @@ impl ApplicationIo for WasmApplicationIo {
let image_canvases_key = JsValue::from_str("imageCanvases"); let image_canvases_key = JsValue::from_str("imageCanvases");
let mut canvases = Reflect::get(&window, &image_canvases_key); let mut canvases = Reflect::get(&window, &image_canvases_key);
if let Err(_) = canvases { if canvases.is_err() {
Reflect::set(&JsValue::from(web_sys::window().unwrap()), &image_canvases_key, &Object::new()).unwrap(); Reflect::set(&JsValue::from(web_sys::window().unwrap()), &image_canvases_key, &Object::new()).unwrap();
canvases = Reflect::get(&window, &image_canvases_key); canvases = Reflect::get(&window, &image_canvases_key);
} }
@ -117,11 +117,11 @@ async fn draw_image_frame_node<'a: 'input>(image: ImageFrame<SRGBA8>, surface_ha
let canvas = surface_handle.surface.canvas().expect("Failed to get canvas"); let canvas = surface_handle.surface.canvas().expect("Failed to get canvas");
canvas.set_width(image.image.width); canvas.set_width(image.image.width);
canvas.set_height(image.image.height); canvas.set_height(image.image.height);
let image_data = web_sys::ImageData::new_with_u8_clamped_array_and_sh(array, image.image.width as u32, image.image.height as u32).expect("Failed to construct ImageData"); let image_data = web_sys::ImageData::new_with_u8_clamped_array_and_sh(array, image.image.width, image.image.height).expect("Failed to construct ImageData");
surface_handle.surface.put_image_data(&image_data, 0.0, 0.0).unwrap(); surface_handle.surface.put_image_data(&image_data, 0.0, 0.0).unwrap();
} }
SurfaceHandleFrame { SurfaceHandleFrame {
surface_handle: surface_handle.into(), surface_handle,
transform: image.transform, transform: image.transform,
} }
} }

View File

@ -1,6 +1,6 @@
#![allow(clippy::too_many_arguments)]
use super::Color; use super::Color;
use crate::Node; use crate::Node;
use core::fmt::Debug; use core::fmt::Debug;
use dyn_any::{DynAny, StaticType}; use dyn_any::{DynAny, StaticType};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
@ -195,7 +195,7 @@ fn extract_channel_node(color: Color, channel: RedGreenBlue) -> Color {
RedGreenBlue::Green => color.g(), RedGreenBlue::Green => color.g(),
RedGreenBlue::Blue => color.b(), RedGreenBlue::Blue => color.b(),
}; };
return color.map_rgb(|_| extracted_value); color.map_rgb(|_| extracted_value)
} }
#[derive(Debug, Clone, Copy, Default)] #[derive(Debug, Clone, Copy, Default)]

View File

@ -1,3 +1,4 @@
#![allow(clippy::neg_cmp_op_on_partial_ord)]
//! Fast conversions between u8 sRGB and linear float. //! Fast conversions between u8 sRGB and linear float.
// Inspired by https://gist.github.com/rygorous/2203834, but with a slightly // Inspired by https://gist.github.com/rygorous/2203834, but with a slightly

View File

@ -13,7 +13,7 @@ mod base64_serde {
use super::super::Pixel; use super::super::Pixel;
use serde::{Deserialize, Deserializer, Serializer}; use serde::{Deserialize, Deserializer, Serializer};
pub fn as_base64<S, P: Pixel>(key: &Vec<P>, serializer: S) -> Result<S::Ok, S::Error> pub fn as_base64<S, P: Pixel>(key: &[P], serializer: S) -> Result<S::Ok, S::Error>
where where
S: Serializer, S: Serializer,
{ {
@ -27,7 +27,7 @@ mod base64_serde {
{ {
use serde::de::Error; use serde::de::Error;
let color_from_chunk = |chunk: &[u8]| P::from_bytes(chunk.try_into().unwrap()); let color_from_chunk = |chunk: &[u8]| P::from_bytes(chunk);
let colors_from_bytes = |bytes: Vec<u8>| bytes.chunks_exact(P::byte_size()).map(color_from_chunk).collect(); let colors_from_bytes = |bytes: Vec<u8>| bytes.chunks_exact(P::byte_size()).map(color_from_chunk).collect();

View File

@ -26,23 +26,24 @@ impl OutlineBuilder for Builder {
if !self.current_subpath.is_empty() { if !self.current_subpath.is_empty() {
self.other_subpaths.push(core::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false))); self.other_subpaths.push(core::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false)));
} }
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(self.point(x, y), self.id.next())); self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(self.point(x, y), self.id.next_id()));
} }
fn line_to(&mut self, x: f32, y: f32) { fn line_to(&mut self, x: f32, y: f32) {
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(self.point(x, y), self.id.next())); self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(self.point(x, y), self.id.next_id()));
} }
fn quad_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32) { fn quad_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32) {
let [handle, anchor] = [self.point(x1, y1), self.point(x2, y2)]; let [handle, anchor] = [self.point(x1, y1), self.point(x2, y2)];
self.current_subpath.last_manipulator_group_mut().unwrap().out_handle = Some(handle); self.current_subpath.last_manipulator_group_mut().unwrap().out_handle = Some(handle);
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(anchor, self.id.next())); self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(anchor, self.id.next_id()));
} }
fn curve_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32) { fn curve_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32) {
let [handle1, handle2, anchor] = [self.point(x1, y1), self.point(x2, y2), self.point(x3, y3)]; let [handle1, handle2, anchor] = [self.point(x1, y1), self.point(x2, y2), self.point(x3, y3)];
self.current_subpath.last_manipulator_group_mut().unwrap().out_handle = Some(handle1); self.current_subpath.last_manipulator_group_mut().unwrap().out_handle = Some(handle1);
self.current_subpath.push_manipulator_group(ManipulatorGroup::new_with_id(anchor, Some(handle2), None, self.id.next())); self.current_subpath
.push_manipulator_group(ManipulatorGroup::new_with_id(anchor, Some(handle2), None, self.id.next_id()));
} }
fn close(&mut self) { fn close(&mut self) {

View File

@ -84,7 +84,7 @@ impl bezier_rs::Identifier for ManipulatorGroupId {
impl ManipulatorGroupId { impl ManipulatorGroupId {
pub const ZERO: ManipulatorGroupId = ManipulatorGroupId(0); pub const ZERO: ManipulatorGroupId = ManipulatorGroupId(0);
pub fn next(&mut self) -> Self { pub fn next_id(&mut self) -> Self {
let old = self.0; let old = self.0;
self.0 += 1; self.0 += 1;
Self(old) Self(old)

View File

@ -115,8 +115,8 @@ impl<'i, T: Clone + 'i> Node<'i, ()> for DebugClonedNode<T> {
} }
impl<T: Clone> DebugClonedNode<T> { impl<T: Clone> DebugClonedNode<T> {
pub const fn new(value: T) -> ClonedNode<T> { pub const fn new(value: T) -> DebugClonedNode<T> {
ClonedNode(value) DebugClonedNode(value)
} }
} }

View File

@ -614,7 +614,7 @@ impl NodeNetwork {
fn replace_network_outputs(&mut self, old_output: NodeOutput, new_output: NodeOutput) { fn replace_network_outputs(&mut self, old_output: NodeOutput, new_output: NodeOutput) {
for output in self.outputs.iter_mut() { for output in self.outputs.iter_mut() {
if *output == old_output { if *output == old_output {
*output = new_output.clone(); *output = new_output;
} }
} }
} }

View File

@ -544,9 +544,9 @@ impl TypingContext {
if matches!(input, Type::Generic(_)) { if matches!(input, Type::Generic(_)) {
return Err(format!("Generic types are not supported as inputs yet {:?} occured in {:?}", &input, node.identifier)); return Err(format!("Generic types are not supported as inputs yet {:?} occured in {:?}", &input, node.identifier));
} }
if parameters.iter().any(|p| match p { if parameters.iter().any(|p| {
Type::Fn(_, b) if matches!(b.as_ref(), Type::Generic(_)) => true, matches!(p,
_ => false, Type::Fn(_, b) if matches!(b.as_ref(), Type::Generic(_)))
}) { }) {
return Err(format!("Generic types are not supported in parameters: {:?} occured in {:?}", parameters, node.identifier)); return Err(format!("Generic types are not supported in parameters: {:?} occured in {:?}", parameters, node.identifier));
} }

View File

@ -117,7 +117,7 @@ where
} }
} }
impl<'i, N> FutureWrapperNode<N> { impl<N> FutureWrapperNode<N> {
pub const fn new(node: N) -> Self { pub const fn new(node: N) -> Self {
Self { node } Self { node }
} }

View File

@ -170,7 +170,7 @@ fn blit_node<_P: Alpha + Pixel + std::fmt::Debug, BlendFn>(mut target: ImageFram
where where
BlendFn: for<'any_input> Node<'any_input, (_P, _P), Output = _P>, BlendFn: for<'any_input> Node<'any_input, (_P, _P), Output = _P>,
{ {
if positions.len() == 0 { if positions.is_empty() {
return target; return target;
} }

View File

@ -402,11 +402,7 @@ async fn blend_gpu_image(foreground: ImageFrame<Color>, background: ImageFrame<C
}; };
log::debug!("created pipeline"); log::debug!("created pipeline");
let compute_pass = executor let compute_pass = executor
.create_compute_pass( .create_compute_pass(&pipeline, Some(readback_buffer.clone()), ComputePassDimensions::XY(background.image.width, background.image.height))
&pipeline,
Some(readback_buffer.clone()),
ComputePassDimensions::XY(background.image.width as u32, background.image.height as u32),
)
.unwrap(); .unwrap();
executor.execute_compute_pipeline(compute_pass).unwrap(); executor.execute_compute_pipeline(compute_pass).unwrap();
log::debug!("executed pipeline"); log::debug!("executed pipeline");

View File

@ -156,7 +156,7 @@ impl BorrowTree {
let upcasted = UpcastNode::new(value); let upcasted = UpcastNode::new(value);
let node = Box::new(upcasted) as TypeErasedBox<'_>; let node = Box::new(upcasted) as TypeErasedBox<'_>;
let node = NodeContainer::new(node); let node = NodeContainer::new(node);
self.store_node(node.into(), id); self.store_node(node, id);
} }
ConstructionArgs::Inline(_) => unimplemented!("Inline nodes are not supported yet"), ConstructionArgs::Inline(_) => unimplemented!("Inline nodes are not supported yet"),
ConstructionArgs::Nodes(ids) => { ConstructionArgs::Nodes(ids) => {
@ -165,7 +165,7 @@ impl BorrowTree {
let constructor = typing_context.constructor(id).ok_or(format!("No constructor found for node {:?}", identifier))?; let constructor = typing_context.constructor(id).ok_or(format!("No constructor found for node {:?}", identifier))?;
let node = constructor(construction_nodes).await; let node = constructor(construction_nodes).await;
let node = NodeContainer::new(node); let node = NodeContainer::new(node);
self.store_node(node.into(), id); self.store_node(node, id);
} }
}; };
Ok(()) Ok(())

View File

@ -3,7 +3,7 @@ pub mod node_registry;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use dyn_any::IntoDynAny;
use graph_craft::document::value::TaggedValue; use graph_craft::document::value::TaggedValue;
use graphene_core::*; use graphene_core::*;
use std::borrow::Cow; use std::borrow::Cow;
@ -123,6 +123,6 @@ mod tests {
let compiler = Compiler {}; let compiler = Compiler {};
let protograph = compiler.compile_single(network, true).expect("Graph should be generated"); let protograph = compiler.compile_single(network, true).expect("Graph should be generated");
let _exec = block_on(DynamicExecutor::new(protograph)).map(|e| panic!("The network should not type check ")).unwrap_err(); let _exec = block_on(DynamicExecutor::new(protograph)).map(|_e| panic!("The network should not type check ")).unwrap_err();
} }
} }

View File

@ -132,7 +132,7 @@ impl gpu_executor::GpuExecutor for NewExecutor {
encoder.copy_buffer_to_buffer( encoder.copy_buffer_to_buffer(
layout.output_buffer.buffer().ok_or_else(|| anyhow::anyhow!("Tried to use an non buffer as the shader output"))?, layout.output_buffer.buffer().ok_or_else(|| anyhow::anyhow!("Tried to use an non buffer as the shader output"))?,
0, 0,
&output, output,
0, 0,
size, size,
); );
@ -153,7 +153,7 @@ impl gpu_executor::GpuExecutor for NewExecutor {
} }
fn read_output_buffer(&self, buffer: Arc<ShaderInput<Self::BufferHandle>>) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>>>> { fn read_output_buffer(&self, buffer: Arc<ShaderInput<Self::BufferHandle>>) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>>>> {
let future = Box::pin(async move { Box::pin(async move {
if let ShaderInput::ReadBackBuffer(buffer, _) = buffer.as_ref() { if let ShaderInput::ReadBackBuffer(buffer, _) = buffer.as_ref() {
let buffer_slice = buffer.slice(..); let buffer_slice = buffer.slice(..);
@ -187,8 +187,7 @@ impl gpu_executor::GpuExecutor for NewExecutor {
} else { } else {
bail!("Tried to read a non readback buffer") bail!("Tried to read a non readback buffer")
} }
}); }) as _
future
} }
} }

View File

@ -460,10 +460,8 @@ impl WasmSubpath {
outline_piece1.to_svg(&mut outline_piece1_svg, CURVE_ATTRIBUTES.to_string().replace(BLACK, RED), String::new(), String::new(), String::new()); outline_piece1.to_svg(&mut outline_piece1_svg, CURVE_ATTRIBUTES.to_string().replace(BLACK, RED), String::new(), String::new(), String::new());
let mut outline_piece2_svg = String::new(); let mut outline_piece2_svg = String::new();
if outline_piece2.is_some() { if let Some(outline) = outline_piece2 {
outline_piece2 outline.to_svg(&mut outline_piece2_svg, CURVE_ATTRIBUTES.to_string().replace(BLACK, RED), String::new(), String::new(), String::new());
.unwrap()
.to_svg(&mut outline_piece2_svg, CURVE_ATTRIBUTES.to_string().replace(BLACK, RED), String::new(), String::new(), String::new());
} }
wrap_svg_tag(format!("{}{outline_piece1_svg}{outline_piece2_svg}", self.to_default_svg())) wrap_svg_tag(format!("{}{outline_piece1_svg}{outline_piece2_svg}", self.to_default_svg()))