Auto merge of #110019 - jplatte:jplatte/stabilize-is-some-and, r=Amanieu

Stabilize is_some_and

This stabilizes the following public API:

```rust
impl<T> Option<T> {
    pub fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool;
}

impl<T, E> Result<T, E> {
    pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool;
    pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool;
}
```

Closes #93050 (tracking issue).

`@rustbot` label +T-libs-api -T-libs
This commit is contained in:
bors 2023-04-07 08:09:20 +00:00
commit b6f6104a1f
7 changed files with 3 additions and 13 deletions

View File

@ -7,7 +7,6 @@
#![feature(box_patterns)]
#![feature(decl_macro)]
#![feature(if_let_guard)]
#![feature(is_some_and)]
#![feature(is_sorted)]
#![feature(let_chains)]
#![feature(proc_macro_internals)]

View File

@ -20,7 +20,6 @@ Rust MIR: a lowered representation of Rust.
#![feature(try_blocks)]
#![feature(yeet_expr)]
#![feature(if_let_guard)]
#![feature(is_some_and)]
#![recursion_limit = "256"]
#[macro_use]

View File

@ -70,7 +70,6 @@ This API is completely unstable and subject to change.
#![feature(lazy_cell)]
#![feature(slice_partition_dedup)]
#![feature(try_blocks)]
#![feature(is_some_and)]
#![feature(type_alias_impl_trait)]
#![recursion_limit = "256"]

View File

@ -605,8 +605,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(is_some_and)]
///
/// let x: Option<u32> = Some(2);
/// assert_eq!(x.is_some_and(|x| x > 1), true);
///
@ -618,7 +616,7 @@ impl<T> Option<T> {
/// ```
#[must_use]
#[inline]
#[unstable(feature = "is_some_and", issue = "93050")]
#[stable(feature = "is_some_and", since = "CURRENT_RUSTC_VERSION")]
pub fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool {
match self {
None => false,

View File

@ -545,8 +545,6 @@ impl<T, E> Result<T, E> {
/// # Examples
///
/// ```
/// #![feature(is_some_and)]
///
/// let x: Result<u32, &str> = Ok(2);
/// assert_eq!(x.is_ok_and(|x| x > 1), true);
///
@ -558,7 +556,7 @@ impl<T, E> Result<T, E> {
/// ```
#[must_use]
#[inline]
#[unstable(feature = "is_some_and", issue = "93050")]
#[stable(feature = "is_some_and", since = "CURRENT_RUSTC_VERSION")]
pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool {
match self {
Err(_) => false,
@ -590,7 +588,6 @@ impl<T, E> Result<T, E> {
/// # Examples
///
/// ```
/// #![feature(is_some_and)]
/// use std::io::{Error, ErrorKind};
///
/// let x: Result<u32, Error> = Err(Error::new(ErrorKind::NotFound, "!"));
@ -604,7 +601,7 @@ impl<T, E> Result<T, E> {
/// ```
#[must_use]
#[inline]
#[unstable(feature = "is_some_and", issue = "93050")]
#[stable(feature = "is_some_and", since = "CURRENT_RUSTC_VERSION")]
pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool {
match self {
Ok(_) => false,

View File

@ -289,7 +289,6 @@
#![feature(hashmap_internals)]
#![feature(ip)]
#![feature(ip_in_core)]
#![feature(is_some_and)]
#![feature(maybe_uninit_slice)]
#![feature(maybe_uninit_write_slice)]
#![feature(panic_can_unwind)]

View File

@ -5,7 +5,6 @@
#![feature(io_error_more)]
#![feature(variant_count)]
#![feature(yeet_expr)]
#![feature(is_some_and)]
#![feature(nonzero_ops)]
#![feature(local_key_cell_methods)]
#![feature(is_terminal)]