mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Rollup merge of #129087 - slanterns:option_get_or_insert_default, r=dtolnay
Stabilize `option_get_or_insert_default` Closes: https://github.com/rust-lang/rust/issues/82901. `@rustbot` label: +T-libs-api r? libs-api
This commit is contained in:
commit
e76eb96a00
@ -3,7 +3,6 @@
|
|||||||
#![feature(iter_intersperse)]
|
#![feature(iter_intersperse)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(map_many_mut)]
|
#![feature(map_many_mut)]
|
||||||
#![feature(option_get_or_insert_default)]
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![warn(unreachable_pub)]
|
#![warn(unreachable_pub)]
|
||||||
// tidy-alphabetical-end
|
// tidy-alphabetical-end
|
||||||
|
@ -1639,8 +1639,6 @@ impl<T> Option<T> {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(option_get_or_insert_default)]
|
|
||||||
///
|
|
||||||
/// let mut x = None;
|
/// let mut x = None;
|
||||||
///
|
///
|
||||||
/// {
|
/// {
|
||||||
@ -1653,7 +1651,7 @@ impl<T> Option<T> {
|
|||||||
/// assert_eq!(x, Some(7));
|
/// assert_eq!(x, Some(7));
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "option_get_or_insert_default", issue = "82901")]
|
#[stable(feature = "option_get_or_insert_default", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub fn get_or_insert_default(&mut self) -> &mut T
|
pub fn get_or_insert_default(&mut self) -> &mut T
|
||||||
where
|
where
|
||||||
T: Default,
|
T: Default,
|
||||||
|
Loading…
Reference in New Issue
Block a user