Switch to intra-doc links in core::result

This commit is contained in:
Camelid 2020-08-19 14:00:53 -07:00
parent 9900178cba
commit e0430a8aa2

View File

@ -216,17 +216,14 @@
//! [`?`] can only be used in functions that return [`Result`] because of the //! [`?`] can only be used in functions that return [`Result`] because of the
//! early return of [`Err`] that it provides. //! early return of [`Err`] that it provides.
//! //!
//! [`expect`]: enum.Result.html#method.expect //! [`expect`]: Result::expect
//! [`Write`]: ../../std/io/trait.Write.html //! [`Write`]: ../../std/io/trait.Write.html
//! [`write_all`]: ../../std/io/trait.Write.html#method.write_all //! [`write_all`]: ../../std/io/trait.Write.html#method.write_all
//! [`io::Result`]: ../../std/io/type.Result.html //! [`io::Result`]: ../../std/io/type.Result.html
//! [`?`]: ../../std/macro.try.html //! [`?`]: ../../std/macro.try.html
//! [`Result`]: enum.Result.html //! [`Ok(T)`]: Ok
//! [`Ok(T)`]: enum.Result.html#variant.Ok //! [`Err(E)`]: Err
//! [`Err(E)`]: enum.Result.html#variant.Err
//! [`io::Error`]: ../../std/io/struct.Error.html //! [`io::Error`]: ../../std/io/struct.Error.html
//! [`Ok`]: enum.Result.html#variant.Ok
//! [`Err`]: enum.Result.html#variant.Err
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
@ -237,9 +234,6 @@ use crate::{convert, fmt};
/// `Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]). /// `Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).
/// ///
/// See the [`std::result`](index.html) module documentation for details. /// See the [`std::result`](index.html) module documentation for details.
///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
#[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] #[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
#[must_use = "this `Result` may be an `Err` variant, which should be handled"] #[must_use = "this `Result` may be an `Err` variant, which should be handled"]
#[rustc_diagnostic_item = "result_type"] #[rustc_diagnostic_item = "result_type"]
@ -267,8 +261,6 @@ impl<T, E> Result<T, E> {
/// Returns `true` if the result is [`Ok`]. /// Returns `true` if the result is [`Ok`].
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
///
/// # Examples /// # Examples
/// ///
/// Basic usage: /// Basic usage:
@ -290,8 +282,6 @@ impl<T, E> Result<T, E> {
/// Returns `true` if the result is [`Err`]. /// Returns `true` if the result is [`Err`].
/// ///
/// [`Err`]: enum.Result.html#variant.Err
///
/// # Examples /// # Examples
/// ///
/// Basic usage: /// Basic usage:
@ -378,7 +368,7 @@ impl<T, E> Result<T, E> {
/// Converts `self` into an [`Option<T>`], consuming `self`, /// Converts `self` into an [`Option<T>`], consuming `self`,
/// and discarding the error, if any. /// and discarding the error, if any.
/// ///
/// [`Option<T>`]: ../../std/option/enum.Option.html /// [`Option<T>`]: Option
/// ///
/// # Examples /// # Examples
/// ///
@ -405,7 +395,7 @@ impl<T, E> Result<T, E> {
/// Converts `self` into an [`Option<E>`], consuming `self`, /// Converts `self` into an [`Option<E>`], consuming `self`,
/// and discarding the success value, if any. /// and discarding the success value, if any.
/// ///
/// [`Option<E>`]: ../../std/option/enum.Option.html /// [`Option<E>`]: Option
/// ///
/// # Examples /// # Examples
/// ///
@ -497,9 +487,6 @@ impl<T, E> Result<T, E> {
/// ///
/// This function can be used to compose the results of two functions. /// This function can be used to compose the results of two functions.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
///
/// # Examples /// # Examples
/// ///
/// Print the numbers on each line of a string multiplied by two. /// Print the numbers on each line of a string multiplied by two.
@ -530,9 +517,7 @@ impl<T, E> Result<T, E> {
/// the result of a function call, it is recommended to use [`map_or_else`], /// the result of a function call, it is recommended to use [`map_or_else`],
/// which is lazily evaluated. /// which is lazily evaluated.
/// ///
/// [`map_or_else`]: #method.map_or_else /// [`map_or_else`]: Result::map_or_else
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
/// ///
/// # Examples /// # Examples
/// ///
@ -559,8 +544,6 @@ impl<T, E> Result<T, E> {
/// This function can be used to unpack a successful result /// This function can be used to unpack a successful result
/// while handling an error. /// while handling an error.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
/// ///
/// # Examples /// # Examples
/// ///
@ -590,8 +573,6 @@ impl<T, E> Result<T, E> {
/// This function can be used to pass through a successful result while handling /// This function can be used to pass through a successful result while handling
/// an error. /// an error.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
/// ///
/// # Examples /// # Examples
/// ///
@ -671,8 +652,6 @@ impl<T, E> Result<T, E> {
/// Returns `res` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`. /// Returns `res` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
/// ///
/// # Examples /// # Examples
/// ///
@ -706,8 +685,6 @@ impl<T, E> Result<T, E> {
/// Calls `op` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`. /// Calls `op` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
/// ///
/// This function can be used for control flow based on `Result` values. /// This function can be used for control flow based on `Result` values.
/// ///
@ -739,9 +716,7 @@ impl<T, E> Result<T, E> {
/// result of a function call, it is recommended to use [`or_else`], which is /// result of a function call, it is recommended to use [`or_else`], which is
/// lazily evaluated. /// lazily evaluated.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok /// [`or_else`]: Result::or_else
/// [`Err`]: enum.Result.html#variant.Err
/// [`or_else`]: #method.or_else
/// ///
/// # Examples /// # Examples
/// ///
@ -777,8 +752,6 @@ impl<T, E> Result<T, E> {
/// ///
/// This function can be used for control flow based on result values. /// This function can be used for control flow based on result values.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
/// ///
/// # Examples /// # Examples
/// ///
@ -808,9 +781,7 @@ impl<T, E> Result<T, E> {
/// the result of a function call, it is recommended to use [`unwrap_or_else`], /// the result of a function call, it is recommended to use [`unwrap_or_else`],
/// which is lazily evaluated. /// which is lazily evaluated.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok /// [`unwrap_or_else`]: Result::unwrap_or_else
/// [`Err`]: enum.Result.html#variant.Err
/// [`unwrap_or_else`]: #method.unwrap_or_else
/// ///
/// # Examples /// # Examples
/// ///
@ -835,7 +806,6 @@ impl<T, E> Result<T, E> {
/// Returns the contained [`Ok`] value or computes it from a closure. /// Returns the contained [`Ok`] value or computes it from a closure.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// ///
/// # Examples /// # Examples
/// ///
@ -945,8 +915,6 @@ impl<T, E: fmt::Debug> Result<T, E> {
/// Panics if the value is an [`Err`], with a panic message including the /// Panics if the value is an [`Err`], with a panic message including the
/// passed message, and the content of the [`Err`]. /// passed message, and the content of the [`Err`].
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
/// ///
/// # Examples /// # Examples
/// ///
@ -973,17 +941,15 @@ impl<T, E: fmt::Debug> Result<T, E> {
/// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or /// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or
/// [`unwrap_or_default`]. /// [`unwrap_or_default`].
/// ///
/// [`unwrap_or`]: #method.unwrap_or /// [`unwrap_or`]: Result::unwrap_or
/// [`unwrap_or_else`]: #method.unwrap_or_else /// [`unwrap_or_else`]: Result::unwrap_or_else
/// [`unwrap_or_default`]: #method.unwrap_or_default /// [`unwrap_or_default`]: Result::unwrap_or_default
/// ///
/// # Panics /// # Panics
/// ///
/// Panics if the value is an [`Err`], with a panic message provided by the /// Panics if the value is an [`Err`], with a panic message provided by the
/// [`Err`]'s value. /// [`Err`]'s value.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
/// ///
/// # Examples /// # Examples
/// ///
@ -1017,8 +983,6 @@ impl<T: fmt::Debug, E> Result<T, E> {
/// Panics if the value is an [`Ok`], with a panic message including the /// Panics if the value is an [`Ok`], with a panic message including the
/// passed message, and the content of the [`Ok`]. /// passed message, and the content of the [`Ok`].
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
/// ///
/// # Examples /// # Examples
/// ///
@ -1045,8 +1009,6 @@ impl<T: fmt::Debug, E> Result<T, E> {
/// Panics if the value is an [`Ok`], with a custom panic message provided /// Panics if the value is an [`Ok`], with a custom panic message provided
/// by the [`Ok`]'s value. /// by the [`Ok`]'s value.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
/// ///
/// ///
/// # Examples /// # Examples
@ -1095,10 +1057,8 @@ impl<T: Default, E> Result<T, E> {
/// assert_eq!(0, bad_year); /// assert_eq!(0, bad_year);
/// ``` /// ```
/// ///
/// [`parse`]: ../../std/primitive.str.html#method.parse /// [`parse`]: str::parse
/// [`FromStr`]: ../../std/str/trait.FromStr.html /// [`FromStr`]: FromStr
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
#[inline] #[inline]
#[stable(feature = "result_unwrap_or_default", since = "1.16.0")] #[stable(feature = "result_unwrap_or_default", since = "1.16.0")]
pub fn unwrap_or_default(self) -> T { pub fn unwrap_or_default(self) -> T {
@ -1119,9 +1079,7 @@ impl<T, E: Into<!>> Result<T, E> {
/// to compile if the error type of the `Result` is later changed /// to compile if the error type of the `Result` is later changed
/// to an error that can actually occur. /// to an error that can actually occur.
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok /// [`unwrap`]: Result::unwrap
/// [`Err`]: enum.Result.html#variant.Err
/// [`unwrap`]: enum.Result.html#method.unwrap
/// ///
/// # Examples /// # Examples
/// ///
@ -1343,10 +1301,6 @@ impl<'a, T, E> IntoIterator for &'a mut Result<T, E> {
/// The iterator yields one value if the result is [`Ok`], otherwise none. /// The iterator yields one value if the result is [`Ok`], otherwise none.
/// ///
/// Created by [`Result::iter`]. /// Created by [`Result::iter`].
///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Result`]: enum.Result.html
/// [`Result::iter`]: enum.Result.html#method.iter
#[derive(Debug)] #[derive(Debug)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, T: 'a> { pub struct Iter<'a, T: 'a> {
@ -1396,10 +1350,6 @@ impl<T> Clone for Iter<'_, T> {
/// An iterator over a mutable reference to the [`Ok`] variant of a [`Result`]. /// An iterator over a mutable reference to the [`Ok`] variant of a [`Result`].
/// ///
/// Created by [`Result::iter_mut`]. /// Created by [`Result::iter_mut`].
///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Result`]: enum.Result.html
/// [`Result::iter_mut`]: enum.Result.html#method.iter_mut
#[derive(Debug)] #[derive(Debug)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, T: 'a> { pub struct IterMut<'a, T: 'a> {
@ -1445,10 +1395,7 @@ unsafe impl<A> TrustedLen for IterMut<'_, A> {}
/// This struct is created by the [`into_iter`] method on /// This struct is created by the [`into_iter`] method on
/// [`Result`] (provided by the [`IntoIterator`] trait). /// [`Result`] (provided by the [`IntoIterator`] trait).
/// ///
/// [`Ok`]: enum.Result.html#variant.Ok /// [`into_iter`]: IntoIterator::into_iter
/// [`Result`]: enum.Result.html
/// [`into_iter`]: ../iter/trait.IntoIterator.html#tymethod.into_iter
/// [`IntoIterator`]: ../iter/trait.IntoIterator.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<T> { pub struct IntoIter<T> {