Rollup merge of #129086 - slanterns:is_none_or, r=dtolnay
Stabilize `is_none_or` Closes: https://github.com/rust-lang/rust/issues/126383. `@rustbot` label: +T-libs-api r? libs-api
This commit is contained in:
commit
9d57e46f81
5 changed files with 2 additions and 7 deletions
|
@ -6,7 +6,6 @@
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(decl_macro)]
|
#![feature(decl_macro)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(is_none_or)]
|
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![feature(rustdoc_internals)]
|
#![feature(rustdoc_internals)]
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(control_flow_enum)]
|
#![feature(control_flow_enum)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(is_none_or)]
|
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![feature(try_blocks)]
|
#![feature(try_blocks)]
|
||||||
|
|
|
@ -656,8 +656,6 @@ impl<T> Option<T> {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(is_none_or)]
|
|
||||||
///
|
|
||||||
/// let x: Option<u32> = Some(2);
|
/// let x: Option<u32> = Some(2);
|
||||||
/// assert_eq!(x.is_none_or(|x| x > 1), true);
|
/// assert_eq!(x.is_none_or(|x| x > 1), true);
|
||||||
///
|
///
|
||||||
|
@ -669,7 +667,7 @@ impl<T> Option<T> {
|
||||||
/// ```
|
/// ```
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "is_none_or", issue = "126383")]
|
#[stable(feature = "is_none_or", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub fn is_none_or(self, f: impl FnOnce(T) -> bool) -> bool {
|
pub fn is_none_or(self, f: impl FnOnce(T) -> bool) -> bool {
|
||||||
match self {
|
match self {
|
||||||
None => true,
|
None => true,
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(trait_upcasting)]
|
#![feature(trait_upcasting)]
|
||||||
#![feature(strict_overflow_ops)]
|
#![feature(strict_overflow_ops)]
|
||||||
#![feature(is_none_or)]
|
|
||||||
// Configure clippy and other lints
|
// Configure clippy and other lints
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::collapsible_else_if,
|
clippy::collapsible_else_if,
|
||||||
|
|
|
@ -1462,7 +1462,7 @@ fn generic_args_sans_defaults<'ga>(
|
||||||
// otherwise, if the arg is equal to the param default, hide it (unless the
|
// otherwise, if the arg is equal to the param default, hide it (unless the
|
||||||
// default is an error which can happen for the trait Self type)
|
// default is an error which can happen for the trait Self type)
|
||||||
#[allow(unstable_name_collisions)]
|
#[allow(unstable_name_collisions)]
|
||||||
default_parameters.get(i).is_none_or(|default_parameter| {
|
IsNoneOr::is_none_or(default_parameters.get(i), |default_parameter| {
|
||||||
// !is_err(default_parameter.skip_binders())
|
// !is_err(default_parameter.skip_binders())
|
||||||
// &&
|
// &&
|
||||||
arg != &default_parameter.clone().substitute(Interner, ¶meters)
|
arg != &default_parameter.clone().substitute(Interner, ¶meters)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue