mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 19:08:05 +08:00
Fix clippy lints (#1327)
* Fix clippy lints * Update formatting * Remove unsafe send impls * New type for Rc<NodeContainer>
This commit is contained in:
committed by
Keavon Chambers
parent
743803ce04
commit
80cc5bee73
@@ -1,9 +1,9 @@
|
||||
use dyn_any::StaticType;
|
||||
pub use graph_craft::proto::{Any, NodeContainer, TypeErasedBox, TypeErasedNode};
|
||||
use graph_craft::proto::{DynFuture, FutureAny};
|
||||
use graph_craft::proto::{DynFuture, FutureAny, SharedNodeContainer};
|
||||
use graphene_core::NodeIO;
|
||||
pub use graphene_core::{generic, ops, Node};
|
||||
use std::{marker::PhantomData, sync::Arc};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub struct DynAnyNode<I, O, Node> {
|
||||
node: Node,
|
||||
@@ -164,7 +164,7 @@ where
|
||||
/// Wraps around a node taking Box<dyn DynAny> and returning Box<dyn DynAny>
|
||||
#[derive(Clone)]
|
||||
pub struct DowncastBothNode<I, O> {
|
||||
node: Arc<NodeContainer>,
|
||||
node: SharedNodeContainer,
|
||||
_i: PhantomData<I>,
|
||||
_o: PhantomData<O>,
|
||||
}
|
||||
@@ -184,7 +184,7 @@ impl<'input, O: 'input + StaticType, I: 'input + StaticType> Node<'input, I> for
|
||||
}
|
||||
}
|
||||
impl<I, O> DowncastBothNode<I, O> {
|
||||
pub const fn new(node: Arc<NodeContainer>) -> Self {
|
||||
pub const fn new(node: SharedNodeContainer) -> Self {
|
||||
Self {
|
||||
node,
|
||||
_i: core::marker::PhantomData,
|
||||
@@ -196,7 +196,7 @@ impl<I, O> DowncastBothNode<I, O> {
|
||||
/// Wraps around a node taking Box<dyn DynAny> and returning Box<dyn DynAny>
|
||||
#[derive(Clone)]
|
||||
pub struct DowncastBothRefNode<I, O> {
|
||||
node: Arc<NodeContainer>,
|
||||
node: SharedNodeContainer,
|
||||
_i: PhantomData<(I, O)>,
|
||||
}
|
||||
impl<'input, O: 'input + StaticType, I: 'input + StaticType> Node<'input, I> for DowncastBothRefNode<I, O> {
|
||||
@@ -214,14 +214,14 @@ impl<'input, O: 'input + StaticType, I: 'input + StaticType> Node<'input, I> for
|
||||
}
|
||||
}
|
||||
impl<I, O> DowncastBothRefNode<I, O> {
|
||||
pub const fn new(node: Arc<NodeContainer>) -> Self {
|
||||
pub const fn new(node: SharedNodeContainer) -> Self {
|
||||
Self { node, _i: core::marker::PhantomData }
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ComposeTypeErased {
|
||||
first: Arc<NodeContainer>,
|
||||
second: Arc<NodeContainer>,
|
||||
first: SharedNodeContainer,
|
||||
second: SharedNodeContainer,
|
||||
}
|
||||
|
||||
impl<'i, 'a: 'i> Node<'i, Any<'i>> for ComposeTypeErased {
|
||||
@@ -235,12 +235,12 @@ impl<'i, 'a: 'i> Node<'i, Any<'i>> for ComposeTypeErased {
|
||||
}
|
||||
|
||||
impl ComposeTypeErased {
|
||||
pub const fn new(first: Arc<NodeContainer>, second: Arc<NodeContainer>) -> Self {
|
||||
pub const fn new(first: SharedNodeContainer, second: SharedNodeContainer) -> Self {
|
||||
ComposeTypeErased { first, second }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn input_node<O: StaticType>(n: Arc<NodeContainer>) -> DowncastBothNode<(), O> {
|
||||
pub fn input_node<O: StaticType>(n: SharedNodeContainer) -> DowncastBothNode<(), O> {
|
||||
DowncastBothNode::new(n)
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ impl<I, O> PanicNode<I, O> {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use graphene_core::{ops::AddNode, ops::IdNode, value::ValueNode};
|
||||
use graphene_core::{ops::AddNode, ops::IdNode};
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
|
||||
Reference in New Issue
Block a user