Skip to content

Commit 57909f7

Browse files
committed
move the reverse into the iterator
1 parent 63eedfc commit 57909f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc_data_structures/transitive_relation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl<T:Debug+PartialEq> TransitiveRelation<T> {
211211
// - In the example above, we would reverse to
212212
// `[z, y, x]` and then pare down to `[z]`.
213213
// 4. Reverse once more just so that we yield a vector in
214-
// increasing order of index. Maybe this is silly.
214+
// increasing order of index. Not necessary, but why not.
215215
//
216216
// I believe this algorithm yields a minimal set. The
217217
// argument is that, after step 2, we know that no element
@@ -224,11 +224,11 @@ impl<T:Debug+PartialEq> TransitiveRelation<T> {
224224
pare_down(&mut candidates, closure); // (2)
225225
candidates.reverse(); // (3a)
226226
pare_down(&mut candidates, closure); // (3b)
227-
candidates.reverse(); // (4)
228227
candidates
229228
});
230229

231230
lub_indices.into_iter()
231+
.rev() // (4)
232232
.map(|i| &self.elements[i])
233233
.collect()
234234
}

0 commit comments

Comments
 (0)