@@ -479,19 +479,6 @@ impl<T> Option<T> {
479
479
/// assert_eq!(Some(4).unwrap_or_else(|| 2 * k), 4);
480
480
/// assert_eq!(None.unwrap_or_else(|| 2 * k), 20);
481
481
/// ```
482
- #[ rustc_const_unstable( feature = "const_option_match" ) ]
483
- #[ cfg( not( bootstrap) ) ]
484
- #[ inline]
485
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
486
- pub const fn unwrap_or_else < F : FnOnce ( ) -> T > ( self , f : F ) -> T {
487
- match self {
488
- Some ( x) => x,
489
- None => f ( ) ,
490
- }
491
- }
492
-
493
- /// No docs for bootstrap.
494
- #[ cfg( bootstrap) ]
495
482
#[ inline]
496
483
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
497
484
pub fn unwrap_or_else < F : FnOnce ( ) -> T > ( self , f : F ) -> T {
@@ -521,19 +508,6 @@ impl<T> Option<T> {
521
508
///
522
509
/// assert_eq!(maybe_some_len, Some(13));
523
510
/// ```
524
- #[ rustc_const_unstable( feature = "const_option_match" ) ]
525
- #[ cfg( not( bootstrap) ) ]
526
- #[ inline]
527
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
528
- pub const fn map < U , F : FnOnce ( T ) -> U > ( self , f : F ) -> Option < U > {
529
- match self {
530
- Some ( x) => Some ( f ( x) ) ,
531
- None => None ,
532
- }
533
- }
534
-
535
- /// No docs for bootstrap.
536
- #[ cfg( bootstrap) ]
537
511
#[ inline]
538
512
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
539
513
pub fn map < U , F : FnOnce ( T ) -> U > ( self , f : F ) -> Option < U > {
@@ -555,19 +529,6 @@ impl<T> Option<T> {
555
529
/// let x: Option<&str> = None;
556
530
/// assert_eq!(x.map_or(42, |v| v.len()), 42);
557
531
/// ```
558
- #[ rustc_const_unstable( feature = "const_option_match" ) ]
559
- #[ cfg( not( bootstrap) ) ]
560
- #[ inline]
561
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
562
- pub const fn map_or < U , F : FnOnce ( T ) -> U > ( self , default : U , f : F ) -> U {
563
- match self {
564
- Some ( t) => f ( t) ,
565
- None => default,
566
- }
567
- }
568
-
569
- /// No docs for bootstrap.
570
- #[ cfg( bootstrap) ]
571
532
#[ inline]
572
533
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
573
534
pub fn map_or < U , F : FnOnce ( T ) -> U > ( self , default : U , f : F ) -> U {
@@ -591,19 +552,6 @@ impl<T> Option<T> {
591
552
/// let x: Option<&str> = None;
592
553
/// assert_eq!(x.map_or_else(|| 2 * k, |v| v.len()), 42);
593
554
/// ```
594
- #[ rustc_const_unstable( feature = "const_option_match" ) ]
595
- #[ cfg( not( bootstrap) ) ]
596
- #[ inline]
597
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
598
- pub const fn map_or_else < U , D : FnOnce ( ) -> U , F : FnOnce ( T ) -> U > ( self , default : D , f : F ) -> U {
599
- match self {
600
- Some ( t) => f ( t) ,
601
- None => default ( ) ,
602
- }
603
- }
604
-
605
- /// No docs for bootstrap.
606
- #[ cfg( bootstrap) ]
607
555
#[ inline]
608
556
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
609
557
pub fn map_or_else < U , D : FnOnce ( ) -> U , F : FnOnce ( T ) -> U > ( self , default : D , f : F ) -> U {
@@ -676,19 +624,6 @@ impl<T> Option<T> {
676
624
/// let x: Option<&str> = None;
677
625
/// assert_eq!(x.ok_or_else(|| 0), Err(0));
678
626
/// ```
679
- #[ rustc_const_unstable( feature = "const_option_match" ) ]
680
- #[ cfg( not( bootstrap) ) ]
681
- #[ inline]
682
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
683
- pub const fn ok_or_else < E , F : FnOnce ( ) -> E > ( self , err : F ) -> Result < T , E > {
684
- match self {
685
- Some ( v) => Ok ( v) ,
686
- None => Err ( err ( ) ) ,
687
- }
688
- }
689
-
690
- /// No docs for bootstrap.
691
- #[ cfg( bootstrap) ]
692
627
#[ inline]
693
628
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
694
629
pub fn ok_or_else < E , F : FnOnce ( ) -> E > ( self , err : F ) -> Result < T , E > {
@@ -807,19 +742,6 @@ impl<T> Option<T> {
807
742
/// assert_eq!(Some(2).and_then(nope).and_then(sq), None);
808
743
/// assert_eq!(None.and_then(sq).and_then(sq), None);
809
744
/// ```
810
- #[ rustc_const_unstable( feature = "const_option_match" ) ]
811
- #[ cfg( not( bootstrap) ) ]
812
- #[ inline]
813
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
814
- pub const fn and_then < U , F : FnOnce ( T ) -> Option < U > > ( self , f : F ) -> Option < U > {
815
- match self {
816
- Some ( x) => f ( x) ,
817
- None => None ,
818
- }
819
- }
820
-
821
- /// No docs for bootstrap.
822
- #[ cfg( bootstrap) ]
823
745
#[ inline]
824
746
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
825
747
pub fn and_then < U , F : FnOnce ( T ) -> Option < U > > ( self , f : F ) -> Option < U > {
@@ -855,21 +777,6 @@ impl<T> Option<T> {
855
777
/// [`None`]: #variant.None
856
778
/// [`Some(t)`]: #variant.Some
857
779
/// [`Iterator::filter()`]: ../../std/iter/trait.Iterator.html#method.filter
858
- #[ rustc_const_unstable( feature = "const_option_match" ) ]
859
- #[ cfg( not( bootstrap) ) ]
860
- #[ inline]
861
- #[ stable( feature = "option_filter" , since = "1.27.0" ) ]
862
- pub const fn filter < P : FnOnce ( & T ) -> bool > ( self , predicate : P ) -> Self {
863
- if let Some ( x) = self {
864
- if predicate ( & x) {
865
- return Some ( x) ;
866
- }
867
- }
868
- None
869
- }
870
-
871
- /// No docs for bootstrap.
872
- #[ cfg( bootstrap) ]
873
780
#[ inline]
874
781
#[ stable( feature = "option_filter" , since = "1.27.0" ) ]
875
782
pub fn filter < P : FnOnce ( & T ) -> bool > ( self , predicate : P ) -> Self {
@@ -943,19 +850,6 @@ impl<T> Option<T> {
943
850
/// assert_eq!(None.or_else(vikings), Some("vikings"));
944
851
/// assert_eq!(None.or_else(nobody), None);
945
852
/// ```
946
- #[ rustc_const_unstable( feature = "const_option_match" ) ]
947
- #[ cfg( not( bootstrap) ) ]
948
- #[ inline]
949
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
950
- pub const fn or_else < F : FnOnce ( ) -> Option < T > > ( self , f : F ) -> Option < T > {
951
- match self {
952
- Some ( _) => self ,
953
- None => f ( ) ,
954
- }
955
- }
956
-
957
- /// No docs for bootstrap.
958
- #[ cfg( bootstrap) ]
959
853
#[ inline]
960
854
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
961
855
pub fn or_else < F : FnOnce ( ) -> Option < T > > ( self , f : F ) -> Option < T > {
0 commit comments