summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsoc <simon@ochsenreither.de>2023-02-15 18:57:00 +0000
committerGitHub <noreply@github.com>2023-02-15 18:57:00 +0000
commit094365e23c633c09f37d72cb345596cecf541f63 (patch)
tree51e46f82801e027a82e60ca85bc1bffd5325d4d7
parent999ac5f7770bff68bd65f490990d32c3ec1faaa6 (diff)
downloadrust-094365e23c633c09f37d72cb345596cecf541f63.tar.gz
Drop unstable `Option::contains`, `Result::contains`, `Result::contains_err`
-rw-r--r--library/core/src/option.rs30
-rw-r--r--library/core/src/result.rs62
2 files changed, 0 insertions, 92 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 5d5e9559034..9dfaf81b00c 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -1649,36 +1649,6 @@ impl<T> Option<T> {
mem::replace(self, Some(value))
}
- /// Returns `true` if the option is a [`Some`] value containing the given value.
- ///
- /// # Examples
- ///
- /// ```
- /// #![feature(option_result_contains)]
- ///
- /// let x: Option<u32> = Some(2);
- /// assert_eq!(x.contains(&2), true);
- ///
- /// let x: Option<u32> = Some(3);
- /// assert_eq!(x.contains(&2), false);
- ///
- /// let x: Option<u32> = None;
- /// assert_eq!(x.contains(&2), false);
- /// ```
- #[must_use]
- #[inline]
- #[unstable(feature = "option_result_contains", issue = "62358")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn contains<U>(&self, x: &U) -> bool
- where
- U: ~const PartialEq<T>,
- {
- match self {
- Some(y) => x.eq(y),
- None => false,
- }
- }
-
/// Zips `self` with another `Option`.
///
/// If `self` is `Some(s)` and `other` is `Some(o)`, this method returns `Some((s, o))`.
diff --git a/library/core/src/result.rs b/library/core/src/result.rs
index 7596e9cc005..fe89ccd749c 100644
--- a/library/core/src/result.rs
+++ b/library/core/src/result.rs
@@ -1567,68 +1567,6 @@ impl<T, E> Result<T, E> {
Err(e) => e,
}
}
-
- /////////////////////////////////////////////////////////////////////////
- // Misc or niche
- /////////////////////////////////////////////////////////////////////////
-
- /// Returns `true` if the result is an [`Ok`] value containing the given value.
- ///
- /// # Examples
- ///
- /// ```
- /// #![feature(option_result_contains)]
- ///
- /// let x: Result<u32, &str> = Ok(2);
- /// assert_eq!(x.contains(&2), true);
- ///
- /// let x: Result<u32, &str> = Ok(3);
- /// assert_eq!(x.contains(&2), false);
- ///
- /// let x: Result<u32, &str> = Err("Some error message");
- /// assert_eq!(x.contains(&2), false);
- /// ```
- #[must_use]
- #[inline]
- #[unstable(feature = "option_result_contains", issue = "62358")]
- pub fn contains<U>(&self, x: &U) -> bool
- where
- U: PartialEq<T>,
- {
- match self {
- Ok(y) => x == y,
- Err(_) => false,
- }
- }
-
- /// Returns `true` if the result is an [`Err`] value containing the given value.
- ///
- /// # Examples
- ///
- /// ```
- /// #![feature(result_contains_err)]
- ///
- /// let x: Result<u32, &str> = Ok(2);
- /// assert_eq!(x.contains_err(&"Some error message"), false);
- ///
- /// let x: Result<u32, &str> = Err("Some error message");
- /// assert_eq!(x.contains_err(&"Some error message"), true);
- ///
- /// let x: Result<u32, &str> = Err("Some other error message");
- /// assert_eq!(x.contains_err(&"Some error message"), false);
- /// ```
- #[must_use]
- #[inline]
- #[unstable(feature = "result_contains_err", issue = "62358")]
- pub fn contains_err<F>(&self, f: &F) -> bool
- where
- F: PartialEq<E>,
- {
- match self {
- Ok(_) => false,
- Err(e) => f == e,
- }
- }
}
impl<T, E> Result<&T, E> {