From a1b03fe21b152d8a91040468d63fcb709d28bd7e Mon Sep 17 00:00:00 2001 From: Congyu Date: Thu, 29 Feb 2024 16:43:30 +0800 Subject: [PATCH] update tests in README --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9f78c84..ef55a45 100644 --- a/README.md +++ b/README.md @@ -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] @@ -119,9 +118,9 @@ fn collect_rev(node: &LinkNode) -> Vec { } fn connect_all(nodes: &mut [LinkNode], 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]) + } } ```