@@ -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
16341572impl < T , E > Result < & T , E > {
0 commit comments