From c4f5eef3d602742ee712e4bd547f714d4f48d06e Mon Sep 17 00:00:00 2001 From: Ivan Tham <pickfire@riseup.net> Date: Thu, 17 Sep 2020 09:11:28 +0800 Subject: [PATCH 1/3] Simplify iter sources doc and links --- library/core/src/iter/sources.rs | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/library/core/src/iter/sources.rs b/library/core/src/iter/sources.rs index d76fa89bd012c..747240250e711 100644 --- a/library/core/src/iter/sources.rs +++ b/library/core/src/iter/sources.rs @@ -5,9 +5,8 @@ use super::{FusedIterator, TrustedLen}; /// An iterator that repeats an element endlessly. /// -/// This `struct` is created by the [`repeat`] function. See its documentation for more. -/// -/// [`repeat`]: fn.repeat.html +/// This `struct` is created by [`repeat`]. +/// See its documentation for more. #[derive(Clone, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct Repeat<A> { @@ -102,10 +101,8 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> { /// An iterator that repeats elements of type `A` endlessly by /// applying the provided closure `F: FnMut() -> A`. /// -/// This `struct` is created by the [`repeat_with`] function. +/// This `struct` is created by [`repeat_with`]. /// See its documentation for more. -/// -/// [`repeat_with`]: fn.repeat_with.html #[derive(Copy, Clone, Debug)] #[stable(feature = "iterator_repeat_with", since = "1.28.0")] pub struct RepeatWith<F> { @@ -201,9 +198,8 @@ pub fn repeat_with<A, F: FnMut() -> A>(repeater: F) -> RepeatWith<F> { /// An iterator that yields nothing. /// -/// This `struct` is created by the [`empty`] function. See its documentation for more. -/// -/// [`empty`]: fn.empty.html +/// This `struct` is created by [`empty`]. +/// See its documentation for more. #[stable(feature = "iter_empty", since = "1.2.0")] pub struct Empty<T>(marker::PhantomData<T>); @@ -292,9 +288,8 @@ pub const fn empty<T>() -> Empty<T> { /// An iterator that yields an element exactly once. /// -/// This `struct` is created by the [`once`] function. See its documentation for more. -/// -/// [`once`]: fn.once.html +/// This `struct` is created by [`once`]. +/// See its documentation for more. #[derive(Clone, Debug)] #[stable(feature = "iter_once", since = "1.2.0")] pub struct Once<T> { @@ -393,10 +388,8 @@ pub fn once<T>(value: T) -> Once<T> { /// An iterator that yields a single element of type `A` by /// applying the provided closure `F: FnOnce() -> A`. /// -/// This `struct` is created by the [`once_with`] function. +/// This `struct` is created by [`once_with`]. /// See its documentation for more. -/// -/// [`once_with`]: fn.once_with.html #[derive(Clone, Debug)] #[stable(feature = "iter_once_with", since = "1.43.0")] pub struct OnceWith<F> { @@ -549,10 +542,8 @@ where /// An iterator where each iteration calls the provided closure `F: FnMut() -> Option<T>`. /// -/// This `struct` is created by the [`iter::from_fn`] function. +/// This `struct` is created by [`iter::from_fn`]. /// See its documentation for more. -/// -/// [`iter::from_fn`]: fn.from_fn.html #[derive(Clone)] #[stable(feature = "iter_from_fn", since = "1.34.0")] pub struct FromFn<F>(F); @@ -601,10 +592,8 @@ where /// An new iterator where each successive item is computed based on the preceding one. /// -/// This `struct` is created by the [`successors`] function. +/// This `struct` is created by [`successors`]. /// See its documentation for more. -/// -/// [`successors`]: fn.successors.html #[derive(Clone)] #[stable(feature = "iter_successors", since = "1.34.0")] pub struct Successors<T, F> { From a68c360c5eefbd5e669383094d88a0cb07a3529d Mon Sep 17 00:00:00 2001 From: Ivan Tham <pickfire@riseup.net> Date: Sat, 19 Sep 2020 00:04:28 +0800 Subject: [PATCH 2/3] Fix unknown iter::from_fn in sources --- library/core/src/iter/sources.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/iter/sources.rs b/library/core/src/iter/sources.rs index 747240250e711..be016e27d4f35 100644 --- a/library/core/src/iter/sources.rs +++ b/library/core/src/iter/sources.rs @@ -542,7 +542,7 @@ where /// An iterator where each iteration calls the provided closure `F: FnMut() -> Option<T>`. /// -/// This `struct` is created by [`iter::from_fn`]. +/// This `struct` is created by [`from_fn`]. /// See its documentation for more. #[derive(Clone)] #[stable(feature = "iter_from_fn", since = "1.34.0")] From d5a91f00b2b12431958521c8e18046c87fd55f51 Mon Sep 17 00:00:00 2001 From: Ivan Tham <pickfire@riseup.net> Date: Mon, 21 Sep 2020 00:38:10 +0800 Subject: [PATCH 3/3] Add parent path to sources doc --- library/core/src/iter/sources.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/library/core/src/iter/sources.rs b/library/core/src/iter/sources.rs index be016e27d4f35..ae45525fb27e3 100644 --- a/library/core/src/iter/sources.rs +++ b/library/core/src/iter/sources.rs @@ -5,7 +5,7 @@ use super::{FusedIterator, TrustedLen}; /// An iterator that repeats an element endlessly. /// -/// This `struct` is created by [`repeat`]. +/// This `struct` is created by [`iter::repeat`]. /// See its documentation for more. #[derive(Clone, Debug)] #[stable(feature = "rust1", since = "1.0.0")] @@ -101,7 +101,7 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> { /// An iterator that repeats elements of type `A` endlessly by /// applying the provided closure `F: FnMut() -> A`. /// -/// This `struct` is created by [`repeat_with`]. +/// This `struct` is created by [`iter::repeat_with`]. /// See its documentation for more. #[derive(Copy, Clone, Debug)] #[stable(feature = "iterator_repeat_with", since = "1.28.0")] @@ -198,7 +198,7 @@ pub fn repeat_with<A, F: FnMut() -> A>(repeater: F) -> RepeatWith<F> { /// An iterator that yields nothing. /// -/// This `struct` is created by [`empty`]. +/// This `struct` is created by [`iter::empty`]. /// See its documentation for more. #[stable(feature = "iter_empty", since = "1.2.0")] pub struct Empty<T>(marker::PhantomData<T>); @@ -288,7 +288,7 @@ pub const fn empty<T>() -> Empty<T> { /// An iterator that yields an element exactly once. /// -/// This `struct` is created by [`once`]. +/// This `struct` is created by [`iter::once`]. /// See its documentation for more. #[derive(Clone, Debug)] #[stable(feature = "iter_once", since = "1.2.0")] @@ -388,7 +388,7 @@ pub fn once<T>(value: T) -> Once<T> { /// An iterator that yields a single element of type `A` by /// applying the provided closure `F: FnOnce() -> A`. /// -/// This `struct` is created by [`once_with`]. +/// This `struct` is created by [`iter::once_with`]. /// See its documentation for more. #[derive(Clone, Debug)] #[stable(feature = "iter_once_with", since = "1.43.0")] @@ -542,7 +542,7 @@ where /// An iterator where each iteration calls the provided closure `F: FnMut() -> Option<T>`. /// -/// This `struct` is created by [`from_fn`]. +/// This `struct` is created by [`iter::from_fn`]. /// See its documentation for more. #[derive(Clone)] #[stable(feature = "iter_from_fn", since = "1.34.0")] @@ -592,7 +592,7 @@ where /// An new iterator where each successive item is computed based on the preceding one. /// -/// This `struct` is created by [`successors`]. +/// This `struct` is created by [`iter::successors`]. /// See its documentation for more. #[derive(Clone)] #[stable(feature = "iter_successors", since = "1.34.0")]