From 57909f7068c5a2fb63f15bc43a7d3e823205608a Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 21 Aug 2015 14:47:02 -0400 Subject: [PATCH] move the reverse into the iterator --- src/librustc_data_structures/transitive_relation.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_data_structures/transitive_relation.rs b/src/librustc_data_structures/transitive_relation.rs index 9d99f77deb9c..728137f4ae99 100644 --- a/src/librustc_data_structures/transitive_relation.rs +++ b/src/librustc_data_structures/transitive_relation.rs @@ -211,7 +211,7 @@ impl TransitiveRelation { // - In the example above, we would reverse to // `[z, y, x]` and then pare down to `[z]`. // 4. Reverse once more just so that we yield a vector in - // increasing order of index. Maybe this is silly. + // increasing order of index. Not necessary, but why not. // // I believe this algorithm yields a minimal set. The // argument is that, after step 2, we know that no element @@ -224,11 +224,11 @@ impl TransitiveRelation { pare_down(&mut candidates, closure); // (2) candidates.reverse(); // (3a) pare_down(&mut candidates, closure); // (3b) - candidates.reverse(); // (4) candidates }); lub_indices.into_iter() + .rev() // (4) .map(|i| &self.elements[i]) .collect() }