move the reverse into the iterator
This commit is contained in:
parent
63eedfcf53
commit
57909f7068
@ -211,7 +211,7 @@ pub fn minimal_upper_bounds(&self, a: &T, b: &T) -> Vec<&T> {
|
||||
// - 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 @@ pub fn minimal_upper_bounds(&self, a: &T, b: &T) -> Vec<&T> {
|
||||
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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user