Run cargo fmt
diff --git a/benches/dijkstra.rs b/benches/dijkstra.rs
index 0d53ced..7901983 100644
--- a/benches/dijkstra.rs
+++ b/benches/dijkstra.rs
@@ -4,7 +4,7 @@
extern crate test;
use petgraph::prelude::*;
-use std::cmp::{ max, min };
+use std::cmp::{max, min};
use test::Bencher;
use petgraph::algo::dijkstra;
@@ -20,7 +20,7 @@
let j_from = max(0, i as i32 - neighbour_count as i32 / 2) as usize;
let j_to = min(NODE_COUNT, j_from + neighbour_count);
for j in j_from..j_to {
- let n2 = nodes[j];
+ let n2 = nodes[j];
let distance = (i + 3) % 10;
g.add_edge(n1, n2, distance);
}
@@ -30,4 +30,3 @@
let _scores = dijkstra(&g, nodes[0], None, |e| *e.weight());
});
}
-
diff --git a/src/dot.rs b/src/dot.rs
index be39a69..fa31fdf 100644
--- a/src/dot.rs
+++ b/src/dot.rs
@@ -2,7 +2,10 @@
use std::fmt::{self, Display, Write};
-use crate::visit::{GraphBase, GraphRef, Data, GraphProp, NodeRef, EdgeRef, IntoEdgeReferences, IntoNodeReferences, NodeIndexable};
+use crate::visit::{
+ Data, EdgeRef, GraphBase, GraphProp, GraphRef, IntoEdgeReferences, IntoNodeReferences,
+ NodeIndexable, NodeRef,
+};
/// `Dot` implements output to graphviz .dot format for a graph.
///
@@ -70,7 +73,9 @@
/// Create a `Dot` formatting wrapper with custom configuration.
pub fn with_config(graph: G, config: &'a [Config]) -> Self {
- Self::with_attr_getters(graph, config, &|_, _| "".to_string(), &|_, _| "".to_string())
+ Self::with_attr_getters(graph, config, &|_, _| "".to_string(), &|_, _| {
+ "".to_string()
+ })
}
pub fn with_attr_getters(
@@ -79,7 +84,12 @@
get_edge_attributes: &'a dyn Fn(G, G::EdgeRef) -> String,
get_node_attributes: &'a dyn Fn(G, G::NodeRef) -> String,
) -> Self {
- Dot { graph, config, get_edge_attributes, get_node_attributes }
+ Dot {
+ graph,
+ config,
+ get_edge_attributes,
+ get_node_attributes,
+ }
}
}
@@ -102,7 +112,6 @@
_Incomplete(()),
}
-
impl<'a, G> Dot<'a, G>
where
G: GraphBase + IntoNodeReferences + IntoEdgeReferences,
@@ -127,12 +136,7 @@
// output all labels
for node in g.node_references() {
- write!(
- f,
- "{}{} [ ",
- INDENT,
- g.to_index(node.id()),
- )?;
+ write!(f, "{}{} [ ", INDENT, g.to_index(node.id()),)?;
if !self.config.contains(&Config::NodeNoLabel) {
write!(f, "label = \"")?;
if self.config.contains(&Config::NodeIndexLabel) {
@@ -143,7 +147,6 @@
write!(f, "\" ")?;
}
writeln!(f, "{}]", (self.get_node_attributes)(g, node))?;
-
}
// output all edges
for (i, edge) in g.edge_references().enumerate() {
@@ -256,12 +259,11 @@
#[cfg(test)]
mod test {
+ use super::{Config, Dot, Escaper};
use crate::prelude::Graph;
use crate::visit::NodeRef;
- use super::{Dot, Config, Escaper};
use std::fmt::Write;
-
#[test]
fn test_escape() {
let mut buff = String::new();
@@ -272,7 +274,7 @@
assert_eq!(buff, "\\\" \\\\ \\l");
}
- fn simple_graph() -> Graph::<&'static str, &'static str> {
+ fn simple_graph() -> Graph<&'static str, &'static str> {
let mut graph = Graph::<&str, &str>::new();
let a = graph.add_node("A");
let b = graph.add_node("B");
@@ -305,7 +307,10 @@
fn test_nodenolable_option() {
let graph = simple_graph();
let dot = format!("{:?}", Dot::with_config(&graph, &[Config::NodeNoLabel]));
- assert_eq!(dot, "digraph {\n 0 [ ]\n 1 [ ]\n 0 -> 1 [ label = \"\\\"edge_label\\\"\" ]\n}\n");
+ assert_eq!(
+ dot,
+ "digraph {\n 0 [ ]\n 1 [ ]\n 0 -> 1 [ label = \"\\\"edge_label\\\"\" ]\n}\n"
+ );
}
#[test]