Skip to content

Commit

Permalink
update tests in README
Browse files Browse the repository at this point in the history
  • Loading branch information
Congyuwang committed Feb 29, 2024
1 parent d0d11c3 commit a1b03fe
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Let the elements hold the ownership, instead of the collection.
See tests as examples.

```rust
#![feature(get_many_mut)]
use cdlist::LinkNode;

#[test]
Expand Down Expand Up @@ -119,9 +118,9 @@ fn collect_rev<T: Copy>(node: &LinkNode<T>) -> Vec<T> {
}

fn connect_all<T>(nodes: &mut [LinkNode<T>], start: usize, end: usize) {
(start..(end - 1)).zip((start + 1)..end).for_each(|(i, j)| {
let [ni, nj] = nodes.get_many_mut([i, j]).unwrap();
ni.add(nj);
});
for i in start..(end - 1) {
let (ni, nj) = nodes[i..].split_at_mut(1);
ni[0].add(&mut nj[0])
}
}
```

0 comments on commit a1b03fe

Please sign in to comment.