Skip to content

Commit 59310e5

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163293 b: refs/heads/snap-stage3 c: 6f19f8d h: refs/heads/master i: 163291: e3802a5 v: v3
1 parent e889427 commit 59310e5

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: d5c332688c83043dffcf14ef8fd6ba3fafdae55e
4+
refs/heads/snap-stage3: 6f19f8d43051f8c8dff81ed0c82ca2d9026d58a8
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/libcollections/dlist.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -351,18 +351,16 @@ impl<T> DList<T> {
351351
/// println!("{}", e); // prints 2, then 4, then 11, then 7, then 8
352352
/// }
353353
/// ```
354-
pub fn insert_when(&mut self, elt: T, f: |&T, &T| -> bool) {
355-
{
356-
let mut it = self.iter_mut();
357-
loop {
358-
match it.peek_next() {
359-
None => break,
360-
Some(x) => if f(x, &elt) { break }
361-
}
362-
it.next();
354+
pub fn insert_when<F>(&mut self, elt: T, mut f: F) where F: FnMut(&T, &T) -> bool {
355+
let mut it = self.iter_mut();
356+
loop {
357+
match it.peek_next() {
358+
None => break,
359+
Some(x) => if f(x, &elt) { break }
363360
}
364-
it.insert_next(elt);
361+
it.next();
365362
}
363+
it.insert_next(elt);
366364
}
367365

368366
/// Merges `other` into this `DList`, using the function `f`.
@@ -371,7 +369,7 @@ impl<T> DList<T> {
371369
/// put `a` in the result if `f(a, b)` is true, and otherwise `b`.
372370
///
373371
/// This operation should compute in O(max(N, M)) time.
374-
pub fn merge(&mut self, mut other: DList<T>, f: |&T, &T| -> bool) {
372+
pub fn merge<F>(&mut self, mut other: DList<T>, mut f: F) where F: FnMut(&T, &T) -> bool {
375373
{
376374
let mut it = self.iter_mut();
377375
loop {

0 commit comments

Comments
 (0)