]> git.lizzy.rs Git - rust.git/commitdiff
Normalize generic bounds in graph iterators
authorHavvy <ryan.havvy@gmail.com>
Wed, 2 Nov 2016 03:32:02 +0000 (20:32 -0700)
committerHavvy <ryan.havvy@gmail.com>
Wed, 2 Nov 2016 03:32:02 +0000 (20:32 -0700)
Use where clasues and only where clauses for bounds in the
iterators for Graph.

The rest of the code uses bounds on the generic declarations for
Debug, and we may want to change those to for consistency. I did
not do that here because I don't know whether or not that's a good
idea. But for the iterators, they were inconsistent causing
confusion, at least for me.

src/librustc_data_structures/graph/mod.rs

index fdb629ca5a578bad8df15fd1b424fde5be5179f8..111f3a2cd87ef3742047aeb066ace40bf825dc34 100644 (file)
@@ -336,7 +336,7 @@ fn next(&mut self) -> Option<(EdgeIndex, &'g Edge<E>)> {
     }
 }
 
-pub struct AdjacentTargets<'g, N: 'g, E: 'g>
+pub struct AdjacentTargets<'g, N, E>
     where N: 'g,
           E: 'g
 {
@@ -351,7 +351,7 @@ fn next(&mut self) -> Option<NodeIndex> {
     }
 }
 
-pub struct AdjacentSources<'g, N: 'g, E: 'g>
+pub struct AdjacentSources<'g, N, E>
     where N: 'g,
           E: 'g
 {
@@ -366,7 +366,10 @@ fn next(&mut self) -> Option<NodeIndex> {
     }
 }
 
-pub struct DepthFirstTraversal<'g, N: 'g, E: 'g> {
+pub struct DepthFirstTraversal<'g, N, E>
+    where N: 'g,
+          E: 'g
+{
     graph: &'g Graph<N, E>,
     stack: Vec<NodeIndex>,
     visited: BitVector,