提交 a588dcff 编写于 作者: K kennytm 提交者: GitHub

Rollup merge of #47497 - goffrie:patch-1, r=dtolnay

Remove incorrect `Default::default` links, add a new one

`map_or` and `map_or_else` don't use `Default::default`, but `unwrap_or_default` does.
...@@ -407,9 +407,7 @@ pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> { ...@@ -407,9 +407,7 @@ pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> {
} }
/// Applies a function to the contained value (if any), /// Applies a function to the contained value (if any),
/// or returns a [`default`][] (if not). /// or returns the provided default (if not).
///
/// [`default`]: ../default/trait.Default.html#tymethod.default
/// ///
/// # Examples /// # Examples
/// ///
...@@ -430,9 +428,7 @@ pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U { ...@@ -430,9 +428,7 @@ pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U {
} }
/// Applies a function to the contained value (if any), /// Applies a function to the contained value (if any),
/// or computes a [`default`][] (if not). /// or computes a default (if not).
///
/// [`default`]: ../default/trait.Default.html#tymethod.default
/// ///
/// # Examples /// # Examples
/// ///
...@@ -850,7 +846,7 @@ impl<T: Default> Option<T> { ...@@ -850,7 +846,7 @@ impl<T: Default> Option<T> {
/// Returns the contained value or a default /// Returns the contained value or a default
/// ///
/// Consumes the `self` argument then, if [`Some`], returns the contained /// Consumes the `self` argument then, if [`Some`], returns the contained
/// value, otherwise if [`None`], returns the default value for that /// value, otherwise if [`None`], returns the [default value] for that
/// type. /// type.
/// ///
/// # Examples /// # Examples
...@@ -872,6 +868,7 @@ impl<T: Default> Option<T> { ...@@ -872,6 +868,7 @@ impl<T: Default> Option<T> {
/// ///
/// [`Some`]: #variant.Some /// [`Some`]: #variant.Some
/// [`None`]: #variant.None /// [`None`]: #variant.None
/// [default value]: ../default/trait.Default.html#tymethod.default
/// [`parse`]: ../../std/primitive.str.html#method.parse /// [`parse`]: ../../std/primitive.str.html#method.parse
/// [`FromStr`]: ../../std/str/trait.FromStr.html /// [`FromStr`]: ../../std/str/trait.FromStr.html
#[inline] #[inline]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册