From 0eb79f7f039c6cef380f418c370cc302d0adaa7a Mon Sep 17 00:00:00 2001 From: Dailiduzhou Date: Wed, 29 Apr 2026 11:03:18 +0800 Subject: [PATCH] docs: fix incorrect max length in take_while example --- .../src/ch08-functional-vs-imperative-when-elegance-wins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-patterns-book/src/ch08-functional-vs-imperative-when-elegance-wins.md b/rust-patterns-book/src/ch08-functional-vs-imperative-when-elegance-wins.md index 57e090e..840f6c2 100644 --- a/rust-patterns-book/src/ch08-functional-vs-imperative-when-elegance-wins.md +++ b/rust-patterns-book/src/ch08-functional-vs-imperative-when-elegance-wins.md @@ -351,7 +351,7 @@ let samples: Vec = std::iter::from_fn(|| Some(random())) ``` But `take_while` *excludes* the element that fails the predicate, producing anywhere from -zero to nine elements instead of the guaranteed-at-least-one the imperative version provides. You can work around it with `scan` or `chain`, but the imperative version +zero to ten elements instead of the guaranteed-at-least-one the imperative version provides. You can work around it with `scan` or `chain`, but the imperative version is clearer. **When scoped mutability genuinely wins:**