remove redundant field names in struct init
diff --git a/src/algo/dominators.rs b/src/algo/dominators.rs
index 5cbf281..c1f778e 100644
--- a/src/algo/dominators.rs
+++ b/src/algo/dominators.rs
@@ -180,7 +180,7 @@
debug_assert!(!dominators.iter().any(|&dom| dom == UNDEFINED));
Dominators {
- root: root,
+ root,
dominators: dominators.into_iter()
.enumerate()
.map(|(idx, dom_idx)| (post_order[idx], post_order[dom_idx]))
diff --git a/src/algo/mod.rs b/src/algo/mod.rs
index 8d42c9b..6163a2b 100644
--- a/src/algo/mod.rs
+++ b/src/algo/mod.rs
@@ -576,8 +576,8 @@
MinSpanningTree {
graph: g,
node_ids: Some(g.node_references()),
- subgraphs: subgraphs,
- sort_edges: sort_edges,
+ subgraphs,
+ sort_edges,
node_map: HashMap::new(),
node_count: 0,
}
diff --git a/src/csr.rs b/src/csr.rs
index 0986e85..a8ffcb0 100644
--- a/src/csr.rs
+++ b/src/csr.rs
@@ -444,7 +444,7 @@
let index = self.index;
self.index += 1;
EdgeReference {
- index: index,
+ index,
source: self.source,
target: j,
weight: w,
@@ -502,7 +502,7 @@
let index = self.index;
self.index += 1;
return Some(EdgeReference {
- index: index,
+ index,
source: self.source_index,
target: j,
weight: w,
diff --git a/src/data.rs b/src/data.rs
index 03f1b31..bfe528d 100644
--- a/src/data.rs
+++ b/src/data.rs
@@ -356,7 +356,7 @@
iter: self,
node_index: 0,
map: Vec::new(),
- f: f,
+ f,
}
}
}
@@ -389,9 +389,9 @@
Some(elt) => elt,
};
let keep = (self.f)(match elt {
- Element::Node { ref mut weight } => Element::Node { weight: weight },
+ Element::Node { ref mut weight } => Element::Node { weight },
Element::Edge { source, target, ref mut weight }
- => Element::Edge { source: source, target: target, weight: weight },
+ => Element::Edge { source, target, weight },
});
let is_node = if let Element::Node { .. } = elt { true } else { false };
if !keep && is_node {
diff --git a/src/dot.rs b/src/dot.rs
index 1cf420d..3ee079e 100644
--- a/src/dot.rs
+++ b/src/dot.rs
@@ -63,8 +63,8 @@
/// Create a `Dot` formatting wrapper with custom configuration.
pub fn with_config(graph: G, config: &'a [Config]) -> Self {
Dot {
- graph: graph,
- config: config,
+ graph,
+ config,
}
}
}
diff --git a/src/graph_impl/mod.rs b/src/graph_impl/mod.rs
index 670a612..74b840f 100644
--- a/src/graph_impl/mod.rs
+++ b/src/graph_impl/mod.rs
@@ -489,7 +489,7 @@
/// type (N/A if usize).
pub fn add_node(&mut self, weight: N) -> NodeIndex<Ix>
{
- let node = Node{weight: weight, next: [EdgeIndex::end(), EdgeIndex::end()]};
+ let node = Node{weight, next: [EdgeIndex::end(), EdgeIndex::end()]};
let node_idx = NodeIndex::new(self.nodes.len());
// check for max capacity, except if we use usize
assert!(<Ix as IndexType>::max().index() == !0 || NodeIndex::end() != node_idx);
@@ -531,7 +531,7 @@
let edge_idx = EdgeIndex::new(self.edges.len());
assert!(<Ix as IndexType>::max().index() == !0 || EdgeIndex::end() != edge_idx);
let mut edge = Edge {
- weight: weight,
+ weight,
node: [a, b],
next: [EdgeIndex::end(); 2],
};
@@ -933,7 +933,7 @@
/// The whole iteration computes in **O(|V|)** time.
pub fn externals(&self, dir: Direction) -> Externals<N, Ty, Ix>
{
- Externals{iter: self.nodes.iter().enumerate(), dir: dir, ty: PhantomData}
+ Externals{iter: self.nodes.iter().enumerate(), dir, ty: PhantomData}
}
/// Return an iterator over the node indices of the graph.
@@ -1486,9 +1486,9 @@
where Ix: IndexType,
{
EdgesWalkerMut {
- edges: edges,
- next: next,
- dir: dir
+ edges,
+ next,
+ dir
}
}
diff --git a/src/graph_impl/stable_graph/mod.rs b/src/graph_impl/stable_graph/mod.rs
index f34d0ce..338a69f 100644
--- a/src/graph_impl/stable_graph/mod.rs
+++ b/src/graph_impl/stable_graph/mod.rs
@@ -692,7 +692,7 @@
/// The whole iteration computes in **O(|V|)** time.
pub fn externals(&self, dir: Direction) -> Externals<N, Ty, Ix>
{
- Externals { iter: self.raw_nodes().iter().enumerate(), dir: dir, ty: PhantomData }
+ Externals { iter: self.raw_nodes().iter().enumerate(), dir, ty: PhantomData }
}
/// Index the `StableGraph` by two indices, any combination of
@@ -808,7 +808,7 @@
move |i, w| w.as_ref().map(|w| node_map(i, w)),
move |i, w| w.as_ref().map(|w| edge_map(i, w)));
StableGraph {
- g: g,
+ g,
node_count: self.node_count,
edge_count: self.edge_count,
free_node: self.free_node,
@@ -1388,7 +1388,7 @@
EdgeReference {
index: edge_index(i),
node: edge.node,
- weight: weight,
+ weight,
}
}))
}
@@ -1403,7 +1403,7 @@
EdgeReference {
index: edge_index(i),
node: edge.node,
- weight: weight,
+ weight,
}
}))
}
diff --git a/src/graphmap.rs b/src/graphmap.rs
index bb76e5e..3ec4076 100644
--- a/src/graphmap.rs
+++ b/src/graphmap.rs
@@ -349,7 +349,7 @@
None => [].iter(),
},
start_node: a,
- dir: dir,
+ dir,
ty: self.ty,
}
}
@@ -364,7 +364,7 @@
/// Iterator element type is `(N, &E)`.
pub fn edges(&self, from: N) -> Edges<N, E, Ty> {
Edges {
- from: from,
+ from,
iter: self.neighbors(from),
edges: &self.edges,
}
diff --git a/src/isomorphism.rs b/src/isomorphism.rs
index 1554b37..e85c328 100644
--- a/src/isomorphism.rs
+++ b/src/isomorphism.rs
@@ -471,7 +471,7 @@
// Check cardinalities of Tin, Tout sets
if st[0].out_size == st[1].out_size &&
st[0].ins_size == st[1].ins_size {
- let f0 = Frame::Unwind{nodes: nodes, open_list: ol};
+ let f0 = Frame::Unwind{nodes, open_list: ol};
stack.push(f0);
stack.push(Frame::Outer);
continue;
diff --git a/src/matrix_graph.rs b/src/matrix_graph.rs
index 4c083f8..d64747c 100644
--- a/src/matrix_graph.rs
+++ b/src/matrix_graph.rs
@@ -564,7 +564,7 @@
impl<'a, N: 'a, Ix> NodeReferences<'a, N, Ix> {
fn new(nodes: &'a IdStorage<N>) -> Self {
NodeReferences {
- nodes: nodes,
+ nodes,
iter: nodes.iter_ids(),
ix: PhantomData,
}
@@ -598,8 +598,8 @@
fn new(node_adjacencies: &'a [Null], node_capacity: usize) -> Self {
EdgeReferences {
row: 0, column: 0,
- node_adjacencies: node_adjacencies,
- node_capacity: node_capacity,
+ node_adjacencies,
+ node_capacity,
ty: PhantomData,
ix: PhantomData,
}
@@ -678,9 +678,9 @@
fn on_columns(row: usize, node_adjacencies: &'a [Null], node_capacity: usize) -> Self {
Edges {
iter_direction: NeighborIterDirection::Columns,
- node_adjacencies: node_adjacencies,
- node_capacity: node_capacity,
- row: row,
+ node_adjacencies,
+ node_capacity,
+ row,
column: 0,
ty: PhantomData,
ix: PhantomData,
@@ -690,10 +690,10 @@
fn on_rows(column: usize, node_adjacencies: &'a [Null], node_capacity: usize) -> Self {
Edges {
iter_direction: NeighborIterDirection::Rows,
- node_adjacencies: node_adjacencies,
- node_capacity: node_capacity,
+ node_adjacencies,
+ node_capacity,
row: 0,
- column: column,
+ column,
ty: PhantomData,
ix: PhantomData,
}
diff --git a/src/unionfind.rs b/src/unionfind.rs
index 986d60d..d53c113 100644
--- a/src/unionfind.rs
+++ b/src/unionfind.rs
@@ -49,7 +49,7 @@
let rank = vec![0; n];
let parent = (0..n).map(K::new).collect::<Vec<K>>();
- UnionFind{parent: parent, rank: rank}
+ UnionFind{parent, rank}
}
/// Return the representative for `x`.
diff --git a/src/visit/traversal.rs b/src/visit/traversal.rs
index 672a688..36618fe 100644
--- a/src/visit/traversal.rs
+++ b/src/visit/traversal.rs
@@ -59,8 +59,8 @@
/// Create a `Dfs` from a vector and a visit map
pub fn from_parts(stack: Vec<N>, discovered: VM) -> Self {
Dfs {
- stack: stack,
- discovered: discovered,
+ stack,
+ discovered,
}
}
@@ -242,8 +242,8 @@
let mut stack = VecDeque::new();
stack.push_front(start);
Bfs {
- stack: stack,
- discovered: discovered,
+ stack,
+ discovered,
}
}
@@ -364,7 +364,7 @@
{
WalkerIter {
walker: self,
- context: context,
+ context,
}
}
}