From 128a313ee26b06b32e6980b4092435d7d352347d Mon Sep 17 00:00:00 2001 From: Irfan Hudda Date: Sat, 1 Apr 2017 21:58:30 +0530 Subject: [PATCH 1/4] Improve docs of core::option::IntoIter --- src/libcore/option.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index d997f3592fd76..027d370f88f41 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -964,9 +964,15 @@ impl<'a, A> FusedIterator for IterMut<'a, A> {} #[unstable(feature = "trusted_len", issue = "37572")] unsafe impl<'a, A> TrustedLen for IterMut<'a, A> {} -/// An iterator over the item contained inside an [`Option`]. +/// An iterator over the value in [`Some`] variant of an [`Option`]. +/// +/// The iterator yields one value if the [`Option`] is a [`Some`] variant, otherwise none. +/// +/// This `struct` is created by [`Option::into_iter`] function. /// /// [`Option`]: enum.Option.html +/// [`Some`]: enum.Option.html#variant.Some +/// [`Option::into_iter`]: enum.Option.html#method.into_iter #[derive(Clone, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { inner: Item } From 029ace40719baa452c7ac27e42529ec3ae8256c8 Mon Sep 17 00:00:00 2001 From: Irfan Hudda Date: Sat, 1 Apr 2017 22:09:10 +0530 Subject: [PATCH 2/4] Improve docs of core::option::IterMut --- src/libcore/option.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 027d370f88f41..2d50f1b0ae5c4 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -933,9 +933,15 @@ impl<'a, A> Clone for Iter<'a, A> { } } -/// An iterator over a mutable reference of the contained item in an [`Option`]. +/// An iterator over a mutable reference to the [`Some`] variant of an [`Option`]. +/// +/// The iterator yields one value if the [`Option`] is a [`Some`] variant, otherwise none. +/// +/// This `struct` is created by [`Option::iter_mut`] function. /// /// [`Option`]: enum.Option.html +/// [`Some`]: enum.Option.html#variant.Some +/// [`Option::iter_mut`]: enum.Option.html#method.iter_mut #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug)] pub struct IterMut<'a, A: 'a> { inner: Item<&'a mut A> } From c414628782ab60817909de2b98d206782dc15200 Mon Sep 17 00:00:00 2001 From: Irfan Hudda Date: Sat, 1 Apr 2017 22:17:48 +0530 Subject: [PATCH 3/4] Improve docs of core::option::Iter --- src/libcore/option.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 2d50f1b0ae5c4..2cdafbf2570e5 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -894,9 +894,15 @@ impl ExactSizeIterator for Item {} impl FusedIterator for Item {} unsafe impl TrustedLen for Item {} -/// An iterator over a reference of the contained item in an [`Option`]. +/// An iterator over a reference to the [`Some`] variant of an [`Option`]. +/// +/// The iterator yields one value if the [`Option`] is a [`Some`] variant, otherwise none. +/// +/// This `struct` is created by [`Option::iter`] function. /// /// [`Option`]: enum.Option.html +/// [`Some`]: enum.Option.html#variant.Some +/// [`Option::iter`]: enum.Option.html#method.iter #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug)] pub struct Iter<'a, A: 'a> { inner: Item<&'a A> } From 4c9f8ae4fd50b857e7a754087243100764a4e4de Mon Sep 17 00:00:00 2001 From: Irfan Hudda Date: Sun, 2 Apr 2017 06:10:34 +0530 Subject: [PATCH 4/4] Minor changes to core::option docs --- src/libcore/option.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 2cdafbf2570e5..1a48f27762580 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -896,9 +896,9 @@ unsafe impl TrustedLen for Item {} /// An iterator over a reference to the [`Some`] variant of an [`Option`]. /// -/// The iterator yields one value if the [`Option`] is a [`Some`] variant, otherwise none. +/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none. /// -/// This `struct` is created by [`Option::iter`] function. +/// This `struct` is created by the [`Option::iter`] function. /// /// [`Option`]: enum.Option.html /// [`Some`]: enum.Option.html#variant.Some @@ -941,9 +941,9 @@ impl<'a, A> Clone for Iter<'a, A> { /// An iterator over a mutable reference to the [`Some`] variant of an [`Option`]. /// -/// The iterator yields one value if the [`Option`] is a [`Some`] variant, otherwise none. +/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none. /// -/// This `struct` is created by [`Option::iter_mut`] function. +/// This `struct` is created by the [`Option::iter_mut`] function. /// /// [`Option`]: enum.Option.html /// [`Some`]: enum.Option.html#variant.Some @@ -978,9 +978,9 @@ unsafe impl<'a, A> TrustedLen for IterMut<'a, A> {} /// An iterator over the value in [`Some`] variant of an [`Option`]. /// -/// The iterator yields one value if the [`Option`] is a [`Some`] variant, otherwise none. +/// The iterator yields one value if the [`Option`] is a [`Some`], otherwise none. /// -/// This `struct` is created by [`Option::into_iter`] function. +/// This `struct` is created by the [`Option::into_iter`] function. /// /// [`Option`]: enum.Option.html /// [`Some`]: enum.Option.html#variant.Some