Skip to content

Commit 35309a2

Browse files
committed
rustup; fix linked_list test
1 parent 7b970ef commit 35309a2

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
21867225a74d3b07c2b65e32c67f45197db36896
1+
dfe1e3b641abbede6230e3931d14f0d43e5b8e54

tests/run-pass/linked-list.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(linked_list_extras)]
1+
#![feature(linked_list_cursors)]
22
use std::collections::LinkedList;
33

44
fn list_from<T: Clone>(v: &[T]) -> LinkedList<T> {
@@ -9,25 +9,27 @@ fn main() {
99
let mut m = list_from(&[0, 2, 4, 6, 8]);
1010
let len = m.len();
1111
{
12-
let mut it = m.iter_mut();
13-
it.insert_next(-2);
12+
let mut it = m.cursor_front_mut();
13+
it.insert_before(-2);
1414
loop {
15-
match it.next() {
15+
match it.current().copied() {
1616
None => break,
1717
Some(elt) => {
18-
it.insert_next(*elt + 1);
1918
match it.peek_next() {
20-
Some(x) => assert_eq!(*x, *elt + 2),
21-
None => assert_eq!(8, *elt),
19+
Some(x) => assert_eq!(*x, elt + 2),
20+
None => assert_eq!(8, elt),
2221
}
22+
it.insert_after(elt + 1);
23+
it.move_next(); // Move by 2 to skip the one we inserted.
24+
it.move_next();
2325
}
2426
}
2527
}
26-
it.insert_next(0);
27-
it.insert_next(1);
28+
it.insert_before(99);
29+
it.insert_after(-10);
2830
}
2931

3032
assert_eq!(m.len(), 3 + len * 2);
3133
assert_eq!(m.into_iter().collect::<Vec<_>>(),
32-
[-2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1]);
34+
[-10, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 99]);
3335
}

0 commit comments

Comments
 (0)