1
Fork 0

Stabilize bool::then_some

This commit is contained in:
Josh Triplett 2022-05-02 01:12:35 -07:00 committed by Mara Bos
parent fed2c43bbf
commit 0fc5c524f5
23 changed files with 1 additions and 25 deletions

View file

@ -9,12 +9,10 @@ impl bool {
/// # Examples
///
/// ```
/// #![feature(bool_to_option)]
///
/// assert_eq!(false.then_some(0), None);
/// assert_eq!(true.then_some(0), Some(0));
/// ```
#[unstable(feature = "bool_to_option", issue = "80967")]
#[stable(feature = "bool_to_option", since = "1.62.0")]
#[rustc_const_unstable(feature = "const_bool_to_option", issue = "91917")]
#[inline]
pub const fn then_some<T>(self, t: T) -> Option<T>