Skip to content

Commit 6c28e20

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 164765 b: refs/heads/try c: 6f19f8d h: refs/heads/master i: 164763: d8e5e96 v: v3
1 parent 78e84ab commit 6c28e20

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
@@ -2,7 +2,7 @@
22
refs/heads/master: f8f2c7a9537c7f333b242f616aefb75a83860927
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 8443b09e361b96d1f9b7f45a65ed0d31c0e86e70
5-
refs/heads/try: d5c332688c83043dffcf14ef8fd6ba3fafdae55e
5+
refs/heads/try: 6f19f8d43051f8c8dff81ed0c82ca2d9026d58a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/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)