Skip to content

Commit 094365e

Browse files
authored
Drop unstable Option::contains, Result::contains, Result::contains_err
1 parent 999ac5f commit 094365e

File tree

2 files changed

+0
-92
lines changed

2 files changed

+0
-92
lines changed

Diff for: library/core/src/option.rs

-30
Original file line numberDiff line numberDiff line change
@@ -1649,36 +1649,6 @@ impl<T> Option<T> {
16491649
mem::replace(self, Some(value))
16501650
}
16511651

1652-
/// Returns `true` if the option is a [`Some`] value containing the given value.
1653-
///
1654-
/// # Examples
1655-
///
1656-
/// ```
1657-
/// #![feature(option_result_contains)]
1658-
///
1659-
/// let x: Option<u32> = Some(2);
1660-
/// assert_eq!(x.contains(&2), true);
1661-
///
1662-
/// let x: Option<u32> = Some(3);
1663-
/// assert_eq!(x.contains(&2), false);
1664-
///
1665-
/// let x: Option<u32> = None;
1666-
/// assert_eq!(x.contains(&2), false);
1667-
/// ```
1668-
#[must_use]
1669-
#[inline]
1670-
#[unstable(feature = "option_result_contains", issue = "62358")]
1671-
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
1672-
pub const fn contains<U>(&self, x: &U) -> bool
1673-
where
1674-
U: ~const PartialEq<T>,
1675-
{
1676-
match self {
1677-
Some(y) => x.eq(y),
1678-
None => false,
1679-
}
1680-
}
1681-
16821652
/// Zips `self` with another `Option`.
16831653
///
16841654
/// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some((s, o))`.

Diff for: library/core/src/result.rs

-62
Original file line numberDiff line numberDiff line change
@@ -1567,68 +1567,6 @@ impl<T, E> Result<T, E> {
15671567
Err(e) => e,
15681568
}
15691569
}
1570-
1571-
/////////////////////////////////////////////////////////////////////////
1572-
// Misc or niche
1573-
/////////////////////////////////////////////////////////////////////////
1574-
1575-
/// Returns `true` if the result is an [`Ok`] value containing the given value.
1576-
///
1577-
/// # Examples
1578-
///
1579-
/// ```
1580-
/// #![feature(option_result_contains)]
1581-
///
1582-
/// let x: Result<u32, &str> = Ok(2);
1583-
/// assert_eq!(x.contains(&2), true);
1584-
///
1585-
/// let x: Result<u32, &str> = Ok(3);
1586-
/// assert_eq!(x.contains(&2), false);
1587-
///
1588-
/// let x: Result<u32, &str> = Err("Some error message");
1589-
/// assert_eq!(x.contains(&2), false);
1590-
/// ```
1591-
#[must_use]
1592-
#[inline]
1593-
#[unstable(feature = "option_result_contains", issue = "62358")]
1594-
pub fn contains<U>(&self, x: &U) -> bool
1595-
where
1596-
U: PartialEq<T>,
1597-
{
1598-
match self {
1599-
Ok(y) => x == y,
1600-
Err(_) => false,
1601-
}
1602-
}
1603-
1604-
/// Returns `true` if the result is an [`Err`] value containing the given value.
1605-
///
1606-
/// # Examples
1607-
///
1608-
/// ```
1609-
/// #![feature(result_contains_err)]
1610-
///
1611-
/// let x: Result<u32, &str> = Ok(2);
1612-
/// assert_eq!(x.contains_err(&"Some error message"), false);
1613-
///
1614-
/// let x: Result<u32, &str> = Err("Some error message");
1615-
/// assert_eq!(x.contains_err(&"Some error message"), true);
1616-
///
1617-
/// let x: Result<u32, &str> = Err("Some other error message");
1618-
/// assert_eq!(x.contains_err(&"Some error message"), false);
1619-
/// ```
1620-
#[must_use]
1621-
#[inline]
1622-
#[unstable(feature = "result_contains_err", issue = "62358")]
1623-
pub fn contains_err<F>(&self, f: &F) -> bool
1624-
where
1625-
F: PartialEq<E>,
1626-
{
1627-
match self {
1628-
Ok(_) => false,
1629-
Err(e) => f == e,
1630-
}
1631-
}
16321570
}
16331571

16341572
impl<T, E> Result<&T, E> {

0 commit comments

Comments
 (0)