@@ -548,22 +548,25 @@ impl<T, E> Result<T, E> {
548548 /// # Examples
549549 ///
550550 /// ```
551- /// #![feature(is_some_with )]
551+ /// #![feature(is_some_and )]
552552 ///
553553 /// let x: Result<u32, &str> = Ok(2);
554- /// assert_eq!(x.is_ok_and(|& x| x > 1), true);
554+ /// assert_eq!(x.is_ok_and(|x| x > 1), true);
555555 ///
556556 /// let x: Result<u32, &str> = Ok(0);
557- /// assert_eq!(x.is_ok_and(|& x| x > 1), false);
557+ /// assert_eq!(x.is_ok_and(|x| x > 1), false);
558558 ///
559559 /// let x: Result<u32, &str> = Err("hey");
560- /// assert_eq!(x.is_ok_and(|& x| x > 1), false);
560+ /// assert_eq!(x.is_ok_and(|x| x > 1), false);
561561 /// ```
562562 #[ must_use]
563563 #[ inline]
564- #[ unstable( feature = "is_some_with" , issue = "93050" ) ]
565- pub fn is_ok_and ( & self , f : impl FnOnce ( & T ) -> bool ) -> bool {
566- matches ! ( self , Ok ( x) if f( x) )
564+ #[ unstable( feature = "is_some_and" , issue = "93050" ) ]
565+ pub fn is_ok_and ( self , f : impl FnOnce ( T ) -> bool ) -> bool {
566+ match self {
567+ Err ( _) => false ,
568+ Ok ( x) => f ( x) ,
569+ }
567570 }
568571
569572 /// Returns `true` if the result is [`Err`].
@@ -592,7 +595,7 @@ impl<T, E> Result<T, E> {
592595 /// # Examples
593596 ///
594597 /// ```
595- /// #![feature(is_some_with )]
598+ /// #![feature(is_some_and )]
596599 /// use std::io::{Error, ErrorKind};
597600 ///
598601 /// let x: Result<u32, Error> = Err(Error::new(ErrorKind::NotFound, "!"));
@@ -606,9 +609,12 @@ impl<T, E> Result<T, E> {
606609 /// ```
607610 #[ must_use]
608611 #[ inline]
609- #[ unstable( feature = "is_some_with" , issue = "93050" ) ]
610- pub fn is_err_and ( & self , f : impl FnOnce ( & E ) -> bool ) -> bool {
611- matches ! ( self , Err ( x) if f( x) )
612+ #[ unstable( feature = "is_some_and" , issue = "93050" ) ]
613+ pub fn is_err_and ( self , f : impl FnOnce ( E ) -> bool ) -> bool {
614+ match self {
615+ Ok ( _) => false ,
616+ Err ( e) => f ( e) ,
617+ }
612618 }
613619
614620 /////////////////////////////////////////////////////////////////////////
0 commit comments