diff --git a/explorer/command.rs b/explorer/command.rs index b2b632ef7b..41f7039eeb 100644 --- a/explorer/command.rs +++ b/explorer/command.rs @@ -93,7 +93,7 @@ impl std::str::FromStr for PathMetric { } /// Unique name of a node that also lets us recover a [`dfpp::ir::GlobalLocation`]. -/// +/// /// Must be fully expanded basic block nodename, e.g. `bb39[2]@bb58[5]@bb0[4]`. You can find this in the /// comments in analysis_result.frg. #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Debug, Hash)] @@ -280,7 +280,6 @@ impl std::str::FromStr for Direction { } } - #[derive(Debug)] pub enum RunCommandErr<'g> { NodeNotFound(NodeName), @@ -334,4 +333,4 @@ impl<'g> std::fmt::Display for RunCommandErr<'g> { } } } -} \ No newline at end of file +} diff --git a/explorer/graph.rs b/explorer/graph.rs index 2a619e0d2a..c8423db124 100644 --- a/explorer/graph.rs +++ b/explorer/graph.rs @@ -2,8 +2,8 @@ //! which can change the behavior of a graph witout copies. use dfpp::{ - ir::GlobalLocation, ana::inline::{Edge, EdgeType}, + ir::GlobalLocation, }; use petgraph::visit::{ @@ -11,8 +11,6 @@ use petgraph::visit::{ IntoNeighbors, IntoNeighborsDirected, IntoNodeIdentifiers, NodeCount, NodeIndexable, Visitable, }; - - /// The canonical representation fo a graph used by the explorer. pub type Graph<'g> = petgraph::graphmap::GraphMap, Edge, petgraph::Directed>; @@ -149,7 +147,7 @@ impl<'f, G: IntoNodeIdentifiers + IntoEdgeReferences> IntoNodeIdentifiers #[derive(Clone, Copy)] pub struct IgnoreCtrlEdges(G); -impl From for IgnoreCtrlEdges{ +impl From for IgnoreCtrlEdges { fn from(value: G) -> Self { Self(value) } @@ -232,7 +230,7 @@ impl, I: Iterator> std::iter::Iterator /// One of the iterators for [`IgnoreCtrlEdges`] that are needed to run the /// algorithms in [`petgraph`]. -/// +/// /// This is confusingly named I know, but the actual graph is /// [`IgnoreCtrlEdges`], wheras this is an iterator over edges with control /// edges ignored. @@ -326,4 +324,4 @@ impl NodeIndexable for IgnoreCtrlEdges { fn to_index(&self, a: Self::NodeId) -> usize { self.0.to_index(a) } -} \ No newline at end of file +} diff --git a/explorer/main.rs b/explorer/main.rs index 9f70757460..01f8e607c9 100644 --- a/explorer/main.rs +++ b/explorer/main.rs @@ -9,20 +9,15 @@ extern crate serde_lexpr as sexpr; use clap::Parser; -use dfpp::{ - ir::global_location::*, - serializers::Bodies, - Either, HashMap, -}; +use dfpp::{ir::global_location::*, serializers::Bodies, Either, HashMap}; use ringbuffer::RingBufferWrite; -mod graph; mod command; +mod graph; mod run; -use graph::*; use command::*; - +use graph::*; /// Command line arguments for the explorer. #[derive(Parser)] diff --git a/explorer/run.rs b/explorer/run.rs index 9601c69078..a40ce604f1 100644 --- a/explorer/run.rs +++ b/explorer/run.rs @@ -11,17 +11,13 @@ use dfpp::{ Either, HashMap, }; -use petgraph::visit::{ - EdgeRef, IntoEdgesDirected, -}; +use petgraph::visit::{EdgeRef, IntoEdgesDirected}; -use crate::graph::*; use crate::command::*; +use crate::graph::*; use crate::Repl; - - impl<'g> Repl<'g> { fn translate_node(&self, name: NodeName) -> Result, RunCommandErr<'g>> { let map = self @@ -113,10 +109,7 @@ impl<'g> Repl<'g> { Ok(Box::new( [{ let paths = petgraph::algo::bellman_ford( - &WithWeightedEdges::new( - graph, - &|_| 1.0, - ), + &WithWeightedEdges::new(graph, &|_| 1.0), from, ) .unwrap(); @@ -135,10 +128,7 @@ impl<'g> Repl<'g> { Ok(Box::new( [{ let paths = petgraph::algo::bellman_ford( - &WithWeightedEdges::new( - graph, - &|_| 1.0, - ), + &WithWeightedEdges::new(graph, &|_| 1.0), from, ) .unwrap(); @@ -544,6 +534,4 @@ impl<'g> Repl<'g> { self.graph = Some(g); Ok(()) } - - -} \ No newline at end of file +}