From ec101bb4ef025b104ad860bfec2336267091de9b Mon Sep 17 00:00:00 2001 From: wtlin1228 Date: Thu, 26 Dec 2024 12:34:33 +0800 Subject: [PATCH] docs: update code example for Iterator#try_for_each --- library/core/src/iter/traits/iterator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index ff39e8ac25f8f..32c03786b8b28 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -2393,7 +2393,7 @@ pub trait Iterator { /// let res = data.iter().try_for_each(|x| writeln!(stdout(), "{x}")); /// assert!(res.is_ok()); /// - /// let mut it = data.iter().cloned(); + /// let mut it = data.into_iter(); /// let res = it.try_for_each(|x| rename(x, Path::new(x).with_extension("old"))); /// assert!(res.is_err()); /// // It short-circuited, so the remaining items are still in the iterator: