From b89c464bede7247b8ebe66b52109575d1d198e79 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 12 Apr 2021 19:59:52 +0200 Subject: [PATCH] Improve code example for length comparison --- library/alloc/src/vec/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 91c3b16deee..0dab0358d6e 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -2567,7 +2567,7 @@ pub fn splice(&mut self, range: R, replace_with: I) -> Splice<'_, I::IntoI /// # let some_predicate = |x: &mut i32| { *x == 2 || *x == 3 || *x == 6 }; /// # let mut vec = vec![1, 2, 3, 4, 5, 6]; /// let mut i = 0; - /// while i != vec.len() { + /// while i < vec.len() { /// if some_predicate(&mut vec[i]) { /// let val = vec.remove(i); /// // your code here