diff --git a/library/core/src/option.rs b/library/core/src/option.rs index fe8ec7db184b7..fcf9707b74d45 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1780,36 +1780,6 @@ impl Option { 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 = Some(2); - /// assert_eq!(x.contains(&2), true); - /// - /// let x: Option = Some(3); - /// assert_eq!(x.contains(&2), false); - /// - /// let x: Option = 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(&self, x: &U) -> bool - where - U: ~const PartialEq, - { - 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 c8168c3f358a4..76d9b0385d0f2 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1531,68 +1531,6 @@ impl Result { 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 = Ok(2); - /// assert_eq!(x.contains(&2), true); - /// - /// let x: Result = Ok(3); - /// assert_eq!(x.contains(&2), false); - /// - /// let x: Result = Err("Some error message"); - /// assert_eq!(x.contains(&2), false); - /// ``` - #[must_use] - #[inline] - #[unstable(feature = "option_result_contains", issue = "62358")] - pub fn contains(&self, x: &U) -> bool - where - U: PartialEq, - { - 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 = Ok(2); - /// assert_eq!(x.contains_err(&"Some error message"), false); - /// - /// let x: Result = Err("Some error message"); - /// assert_eq!(x.contains_err(&"Some error message"), true); - /// - /// let x: Result = 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(&self, f: &F) -> bool - where - F: PartialEq, - { - match self { - Ok(_) => false, - Err(e) => f == e, - } - } } impl Result<&T, E> { diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 637cc6e9f629b..108210b65734b 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -95,7 +95,6 @@ #![feature(portable_simd)] #![feature(ptr_metadata)] #![feature(once_cell)] -#![feature(option_result_contains)] #![feature(unsized_tuple_coercion)] #![feature(const_option)] #![feature(const_option_ext)]