From a00dfddde1852fc8edba7aa0e5f60e6e9ccb7fb0 Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Wed, 22 Jan 2025 17:24:34 +0100 Subject: [PATCH 1/2] Document purpose of closure in from_fn.rs more clearly --- library/core/src/iter/sources/from_fn.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/iter/sources/from_fn.rs b/library/core/src/iter/sources/from_fn.rs index 5f3d404d7dca..4c60f6914bbb 100644 --- a/library/core/src/iter/sources/from_fn.rs +++ b/library/core/src/iter/sources/from_fn.rs @@ -1,7 +1,7 @@ use crate::fmt; -/// Creates a new iterator where each iteration calls the provided closure -/// `F: FnMut() -> Option`. +/// Creates a new iterator with the provided closure +/// `F: FnMut() -> Option` as its `next` method. /// /// The iterator will yield the `T`s returned from the closure. /// From 7328de0c67cb9b6babae0e3945a3914e94d6ddf4 Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Thu, 23 Jan 2025 08:50:56 +0100 Subject: [PATCH 2/2] link to next method in Iterator::from_fn --- library/core/src/iter/sources/from_fn.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/iter/sources/from_fn.rs b/library/core/src/iter/sources/from_fn.rs index 4c60f6914bbb..75cc0ffe3c77 100644 --- a/library/core/src/iter/sources/from_fn.rs +++ b/library/core/src/iter/sources/from_fn.rs @@ -1,7 +1,7 @@ use crate::fmt; -/// Creates a new iterator with the provided closure -/// `F: FnMut() -> Option` as its `next` method. +/// Creates an iterator with the provided closure +/// `F: FnMut() -> Option` as its `[next](Iterator::next)` method. /// /// The iterator will yield the `T`s returned from the closure. ///