fix naming unconsistency between function doc and prototype
This commit is contained in:
parent
60a96cae33
commit
cc8b77a7cf
@ -566,8 +566,7 @@ pub fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E> {
|
|||||||
// Setting a new value
|
// Setting a new value
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// Inserts `v` into the option then returns a mutable reference
|
/// Inserts `value` into the option then returns a mutable reference to it.
|
||||||
/// to the contained value.
|
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
@ -585,8 +584,8 @@ pub fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E> {
|
|||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "option_insert", reason = "newly added", issue = "none")]
|
#[unstable(feature = "option_insert", reason = "newly added", issue = "none")]
|
||||||
pub fn insert(&mut self, val: T) -> &mut T {
|
pub fn insert(&mut self, value: T) -> &mut T {
|
||||||
*self = Some(val);
|
*self = Some(value);
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
@ -825,7 +824,7 @@ pub fn xor(self, optb: Option<T>) -> Option<T> {
|
|||||||
// Entry-like operations to insert if None and return a reference
|
// Entry-like operations to insert if None and return a reference
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// Inserts `v` into the option if it is [`None`], then
|
/// Inserts `value` into the option if it is [`None`], then
|
||||||
/// returns a mutable reference to the contained value.
|
/// returns a mutable reference to the contained value.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
@ -844,12 +843,12 @@ pub fn xor(self, optb: Option<T>) -> Option<T> {
|
|||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "option_entry", since = "1.20.0")]
|
#[stable(feature = "option_entry", since = "1.20.0")]
|
||||||
pub fn get_or_insert(&mut self, val: T) -> &mut T {
|
pub fn get_or_insert(&mut self, value: T) -> &mut T {
|
||||||
self.get_or_insert_with(|| val)
|
self.get_or_insert_with(|| value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Inserts a value computed from `f` into the option if it is [`None`], then
|
/// Inserts a value computed from `f` into the option if it is [`None`],
|
||||||
/// returns a mutable reference to the contained value.
|
/// then returns a mutable reference to the contained value.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user