From 96282e186618691977192a6cace47f86d8a9aec5 Mon Sep 17 00:00:00 2001 From: Son Date: Mon, 20 Aug 2018 12:04:08 +1000 Subject: [PATCH 1/4] Add doc for impl From for Error --- src/libstd/io/error.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index 3e50988a68b..a6b46fa20b1 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -212,6 +212,12 @@ impl ErrorKind { /// the heap (for normal construction via Error::new) is too costly. #[stable(feature = "io_error_from_errorkind", since = "1.14.0")] impl From for Error { + /// Converts a [`ErrorKind`] into a [`Error`]. + /// + /// This conversion allocates a new error with simple repr. + /// + /// [`ErrorKind`]: enum.ErrorKind.html + /// [`Error`]: struct.Error.html #[inline] fn from(kind: ErrorKind) -> Error { Error { From 70f4269d978090d8ce9a334d9694c8a1f1480eba Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 27 Sep 2018 05:34:12 +1000 Subject: [PATCH 2/4] Doc for From ErrorKind --- src/libstd/io/error.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index a6b46fa20b1..cf5b9c75e9f 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -214,10 +214,19 @@ impl ErrorKind { impl From for Error { /// Converts a [`ErrorKind`] into a [`Error`]. /// - /// This conversion allocates a new error with simple repr. + /// This conversion allocates a new error with a simple representation of error kind. /// - /// [`ErrorKind`]: enum.ErrorKind.html - /// [`Error`]: struct.Error.html + /// # Examples + /// + /// ``` + /// use std::io::{Error, ErrorKind}; + /// + /// fn main() { + /// let not_found = ErrorKind::NotFound; + /// let error = Error::from(not_found); + /// assert_eq!("entity not found", format!("{}", error)); + /// } + /// ``` #[inline] fn from(kind: ErrorKind) -> Error { Error { From b3750aa34e50c0275036a15f28710f934e33bba3 Mon Sep 17 00:00:00 2001 From: Son Date: Wed, 3 Oct 2018 08:25:31 +1000 Subject: [PATCH 3/4] Remove main() from examples --- src/libstd/io/error.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index cf5b9c75e9f..6515a5540ee 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -221,11 +221,9 @@ impl From for Error { /// ``` /// use std::io::{Error, ErrorKind}; /// - /// fn main() { - /// let not_found = ErrorKind::NotFound; - /// let error = Error::from(not_found); - /// assert_eq!("entity not found", format!("{}", error)); - /// } + /// let not_found = ErrorKind::NotFound; + /// let error = Error::from(not_found); + /// assert_eq!("entity not found", format!("{}", error)); /// ``` #[inline] fn from(kind: ErrorKind) -> Error { From 4f3896d8ef381993f333cc7c984991a4590df29f Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sat, 6 Oct 2018 11:21:53 -0400 Subject: [PATCH 4/4] =?UTF-8?q?'a'=20=E2=86=92=20'an'=20in=20front=20of=20?= =?UTF-8?q?vowel=20sounds.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libstd/io/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index 6515a5540ee..386de080b85 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -212,7 +212,7 @@ impl ErrorKind { /// the heap (for normal construction via Error::new) is too costly. #[stable(feature = "io_error_from_errorkind", since = "1.14.0")] impl From for Error { - /// Converts a [`ErrorKind`] into a [`Error`]. + /// Converts an [`ErrorKind`] into an [`Error`]. /// /// This conversion allocates a new error with a simple representation of error kind. ///