Update for changes to index traits
diff --git a/src/graph.rs b/src/graph.rs
index cb6714e..82edc93 100644
--- a/src/graph.rs
+++ b/src/graph.rs
@@ -963,7 +963,7 @@
/// Index the **Graph** by **NodeIndex** to access node weights.
///
/// **Panics** if the node doesn't exist.
- fn index(&self, index: &NodeIndex<Ix>) -> &N {
+ fn index(&self, index: NodeIndex<Ix>) -> &N {
&self.nodes[index.index()].weight
}
}
@@ -975,7 +975,7 @@
/// Index the **Graph** by **NodeIndex** to access node weights.
///
/// **Panics** if the node doesn't exist.
- fn index_mut(&mut self, index: &NodeIndex<Ix>) -> &mut N {
+ fn index_mut(&mut self, index: NodeIndex<Ix>) -> &mut N {
&mut self.nodes[index.index()].weight
}
@@ -988,7 +988,7 @@
/// Index the **Graph** by **EdgeIndex** to access edge weights.
///
/// **Panics** if the edge doesn't exist.
- fn index(&self, index: &EdgeIndex<Ix>) -> &E {
+ fn index(&self, index: EdgeIndex<Ix>) -> &E {
&self.edges[index.index()].weight
}
}
@@ -1000,7 +1000,7 @@
/// Index the **Graph** by **EdgeIndex** to access edge weights.
///
/// **Panics** if the edge doesn't exist.
- fn index_mut(&mut self, index: &EdgeIndex<Ix>) -> &mut E {
+ fn index_mut(&mut self, index: EdgeIndex<Ix>) -> &mut E {
&mut self.edges[index.index()].weight
}
}
diff --git a/src/graphmap.rs b/src/graphmap.rs
index d5992c4..b0af099 100644
--- a/src/graphmap.rs
+++ b/src/graphmap.rs
@@ -320,7 +320,7 @@
{
type Output = E;
/// Index **GraphMap** by node pairs to access edge weights.
- fn index(&self, index: &(N, N)) -> &E
+ fn index(&self, index: (N, N)) -> &E
{
self.edge_weight(index.0, index.1).expect("GraphMap::index: no such edge")
}
@@ -329,7 +329,7 @@
impl<N, E> IndexMut<(N, N)> for GraphMap<N, E> where N: NodeTrait
{
/// Index **GraphMap** by node pairs to access edge weights.
- fn index_mut(&mut self, index: &(N, N)) -> &mut E
+ fn index_mut(&mut self, index: (N, N)) -> &mut E
{
self.edge_weight_mut(index.0, index.1).expect("GraphMap::index: no such edge")
}
diff --git a/tests/ograph.rs b/tests/ograph.rs
index 1f0befa..fd08fdb 100644
--- a/tests/ograph.rs
+++ b/tests/ograph.rs
@@ -325,7 +325,7 @@
vec![("A", 0), ("B", 7), ("C", 9), ("D", 11), ("E", 20), ("F", 20)]);
let scores = dijkstra(&g, a, Some(c), |gr, n| gr.edges(n).map(|(n, &e)| (n, e)));
- assert_eq!(scores[c], 9);
+ assert_eq!(scores[&c], 9);
}
#[test]