A little cleanup

This commit is contained in:
mars 2022-09-17 06:19:53 -06:00
parent 180cd516ea
commit 7de349e60a
2 changed files with 7 additions and 9 deletions

View File

@ -312,7 +312,7 @@ mod tests {
fn three_node_add() -> GraphResult<()> {
let mut graph = Graph::new();
let cmds = three_node_add_cmds();
for cmd in cmds.into_iter() {
println!("{:#?}", cmd);
cmd.apply(&mut graph)?;
@ -323,7 +323,7 @@ mod tests {
Ok(())
}
#[test]
fn three_node_add_rewind() -> GraphResult<()> {
let mut graph = Graph::new();

View File

@ -7,7 +7,7 @@ use node::{AtomOp, Edge, Node, NodeKind, SlotIndex};
fn main() {
let mut graph = Graph::new();
let nodes = &mut graph.nodes;
let n0 = nodes.insert(Node::literal(1.0));
let n1 = nodes.insert(Node::literal(2.0));
@ -15,9 +15,9 @@ fn main() {
let n3 = nodes.insert(Node::literal(4.0));
let n4 = nodes.insert(Node::op(AtomOp::Div, n2, n3));
let n5 = nodes.insert(Node::op(AtomOp::Mul, n4, n4));
let n6 = nodes.insert(Node::op(AtomOp::Add, n5, n0));
let n7 = nodes.insert(Node::literal(0.0)); // Should be ignored since it's not used
let _n6 = nodes.insert(Node::op(AtomOp::Add, n5, n0));
let _n7 = nodes.insert(Node::literal(0.0)); // Should be ignored since it's not used
graph.compile().expect("Compilation failure");
}
@ -37,9 +37,7 @@ pub struct Graph {
impl Graph {
fn new() -> Self {
Self {
nodes: Slab::new()
}
Self { nodes: Slab::new() }
}
fn get_node(&self, index: usize) -> GraphResult<&Node> {