File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -638,6 +638,10 @@ impl<T> Option<T> {
638
638
///
639
639
/// let x: Option<u32> = None;
640
640
/// assert_eq!(x.is_some_and(|x| x > 1), false);
641
+ ///
642
+ /// let x: Option<String> = Some("ownership".to_string());
643
+ /// assert_eq!(x.as_ref().is_some_and(|x| x.len() > 1), true);
644
+ /// println!("still alive {:?}", x);
641
645
/// ```
642
646
#[ must_use]
643
647
#[ inline]
@@ -682,6 +686,10 @@ impl<T> Option<T> {
682
686
///
683
687
/// let x: Option<u32> = None;
684
688
/// assert_eq!(x.is_none_or(|x| x > 1), true);
689
+ ///
690
+ /// let x: Option<String> = Some("ownership".to_string());
691
+ /// assert_eq!(x.as_ref().is_none_or(|x| x.len() > 1), true);
692
+ /// println!("still alive {:?}", x);
685
693
/// ```
686
694
#[ must_use]
687
695
#[ inline]
You can’t perform that action at this time.
0 commit comments