Skip to content

Commit 7afdaf2

Browse files
committed
Stop relying on #[feature(try_trait)] in doctests.
1 parent d442c10 commit 7afdaf2

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

library/core/src/num/nonzero.rs

+45-45
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,18 @@ macro_rules! nonzero_unsigned_operations {
300300
///
301301
/// ```
302302
/// #![feature(nonzero_ops)]
303-
/// # #![feature(try_trait)]
304303
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
305304
///
306-
/// # fn main() -> Result<(), std::option::NoneError> {
305+
/// # fn main() { test().unwrap(); }
306+
/// # fn test() -> Option<()> {
307307
#[doc = concat!("let one = ", stringify!($Ty), "::new(1)?;")]
308308
#[doc = concat!("let two = ", stringify!($Ty), "::new(2)?;")]
309309
#[doc = concat!("let max = ", stringify!($Ty), "::new(",
310310
stringify!($Int), "::MAX)?;")]
311311
///
312312
/// assert_eq!(Some(two), one.checked_add(1));
313313
/// assert_eq!(None, max.checked_add(1));
314-
/// # Ok(())
314+
/// # Some(())
315315
/// # }
316316
/// ```
317317
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -333,18 +333,18 @@ macro_rules! nonzero_unsigned_operations {
333333
///
334334
/// ```
335335
/// #![feature(nonzero_ops)]
336-
/// # #![feature(try_trait)]
337336
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
338337
///
339-
/// # fn main() -> Result<(), std::option::NoneError> {
338+
/// # fn main() { test().unwrap(); }
339+
/// # fn test() -> Option<()> {
340340
#[doc = concat!("let one = ", stringify!($Ty), "::new(1)?;")]
341341
#[doc = concat!("let two = ", stringify!($Ty), "::new(2)?;")]
342342
#[doc = concat!("let max = ", stringify!($Ty), "::new(",
343343
stringify!($Int), "::MAX)?;")]
344344
///
345345
/// assert_eq!(two, one.saturating_add(1));
346346
/// assert_eq!(max, max.saturating_add(1));
347-
/// # Ok(())
347+
/// # Some(())
348348
/// # }
349349
/// ```
350350
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -366,15 +366,15 @@ macro_rules! nonzero_unsigned_operations {
366366
///
367367
/// ```
368368
/// #![feature(nonzero_ops)]
369-
/// # #![feature(try_trait)]
370369
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
371370
///
372-
/// # fn main() -> Result<(), std::option::NoneError> {
371+
/// # fn main() { test().unwrap(); }
372+
/// # fn test() -> Option<()> {
373373
#[doc = concat!("let one = ", stringify!($Ty), "::new(1)?;")]
374374
#[doc = concat!("let two = ", stringify!($Ty), "::new(2)?;")]
375375
///
376376
/// assert_eq!(two, unsafe { one.unchecked_add(1) });
377-
/// # Ok(())
377+
/// # Some(())
378378
/// # }
379379
/// ```
380380
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -393,10 +393,10 @@ macro_rules! nonzero_unsigned_operations {
393393
///
394394
/// ```
395395
/// #![feature(nonzero_ops)]
396-
/// # #![feature(try_trait)]
397396
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
398397
///
399-
/// # fn main() -> Result<(), std::option::NoneError> {
398+
/// # fn main() { test().unwrap(); }
399+
/// # fn test() -> Option<()> {
400400
#[doc = concat!("let two = ", stringify!($Ty), "::new(2)?;")]
401401
#[doc = concat!("let three = ", stringify!($Ty), "::new(3)?;")]
402402
#[doc = concat!("let four = ", stringify!($Ty), "::new(4)?;")]
@@ -406,7 +406,7 @@ macro_rules! nonzero_unsigned_operations {
406406
/// assert_eq!(Some(two), two.checked_next_power_of_two() );
407407
/// assert_eq!(Some(four), three.checked_next_power_of_two() );
408408
/// assert_eq!(None, max.checked_next_power_of_two() );
409-
/// # Ok(())
409+
/// # Some(())
410410
/// # }
411411
/// ```
412412
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -447,16 +447,16 @@ macro_rules! nonzero_signed_operations {
447447
///
448448
/// ```
449449
/// #![feature(nonzero_ops)]
450-
/// # #![feature(try_trait)]
451450
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
452451
///
453-
/// # fn main() -> Result<(), std::option::NoneError> {
452+
/// # fn main() { test().unwrap(); }
453+
/// # fn test() -> Option<()> {
454454
#[doc = concat!("let pos = ", stringify!($Ty), "::new(1)?;")]
455455
#[doc = concat!("let neg = ", stringify!($Ty), "::new(-1)?;")]
456456
///
457457
/// assert_eq!(pos, pos.abs());
458458
/// assert_eq!(pos, neg.abs());
459-
/// # Ok(())
459+
/// # Some(())
460460
/// # }
461461
/// ```
462462
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -475,18 +475,18 @@ macro_rules! nonzero_signed_operations {
475475
///
476476
/// ```
477477
/// #![feature(nonzero_ops)]
478-
/// # #![feature(try_trait)]
479478
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
480479
///
481-
/// # fn main() -> Result<(), std::option::NoneError> {
480+
/// # fn main() { test().unwrap(); }
481+
/// # fn test() -> Option<()> {
482482
#[doc = concat!("let pos = ", stringify!($Ty), "::new(1)?;")]
483483
#[doc = concat!("let neg = ", stringify!($Ty), "::new(-1)?;")]
484484
#[doc = concat!("let min = ", stringify!($Ty), "::new(",
485485
stringify!($Int), "::MIN)?;")]
486486
///
487487
/// assert_eq!(Some(pos), neg.checked_abs());
488488
/// assert_eq!(None, min.checked_abs());
489-
/// # Ok(())
489+
/// # Some(())
490490
/// # }
491491
/// ```
492492
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -508,10 +508,10 @@ macro_rules! nonzero_signed_operations {
508508
///
509509
/// ```
510510
/// #![feature(nonzero_ops)]
511-
/// # #![feature(try_trait)]
512511
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
513512
///
514-
/// # fn main() -> Result<(), std::option::NoneError> {
513+
/// # fn main() { test().unwrap(); }
514+
/// # fn test() -> Option<()> {
515515
#[doc = concat!("let pos = ", stringify!($Ty), "::new(1)?;")]
516516
#[doc = concat!("let neg = ", stringify!($Ty), "::new(-1)?;")]
517517
#[doc = concat!("let min = ", stringify!($Ty), "::new(",
@@ -520,7 +520,7 @@ macro_rules! nonzero_signed_operations {
520520
/// assert_eq!((pos, false), pos.overflowing_abs());
521521
/// assert_eq!((pos, false), neg.overflowing_abs());
522522
/// assert_eq!((min, true), min.overflowing_abs());
523-
/// # Ok(())
523+
/// # Some(())
524524
/// # }
525525
/// ```
526526
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -541,10 +541,10 @@ macro_rules! nonzero_signed_operations {
541541
///
542542
/// ```
543543
/// #![feature(nonzero_ops)]
544-
/// # #![feature(try_trait)]
545544
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
546545
///
547-
/// # fn main() -> Result<(), std::option::NoneError> {
546+
/// # fn main() { test().unwrap(); }
547+
/// # fn test() -> Option<()> {
548548
#[doc = concat!("let pos = ", stringify!($Ty), "::new(1)?;")]
549549
#[doc = concat!("let neg = ", stringify!($Ty), "::new(-1)?;")]
550550
#[doc = concat!("let min = ", stringify!($Ty), "::new(",
@@ -558,7 +558,7 @@ macro_rules! nonzero_signed_operations {
558558
/// assert_eq!(pos, neg.saturating_abs());
559559
/// assert_eq!(max, min.saturating_abs());
560560
/// assert_eq!(max, min_plus.saturating_abs());
561-
/// # Ok(())
561+
/// # Some(())
562562
/// # }
563563
/// ```
564564
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -575,10 +575,10 @@ macro_rules! nonzero_signed_operations {
575575
///
576576
/// ```
577577
/// #![feature(nonzero_ops)]
578-
/// # #![feature(try_trait)]
579578
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
580579
///
581-
/// # fn main() -> Result<(), std::option::NoneError> {
580+
/// # fn main() { test().unwrap(); }
581+
/// # fn test() -> Option<()> {
582582
#[doc = concat!("let pos = ", stringify!($Ty), "::new(1)?;")]
583583
#[doc = concat!("let neg = ", stringify!($Ty), "::new(-1)?;")]
584584
#[doc = concat!("let min = ", stringify!($Ty), "::new(",
@@ -591,7 +591,7 @@ macro_rules! nonzero_signed_operations {
591591
/// assert_eq!(min, min.wrapping_abs());
592592
/// # // FIXME: add once Neg is implemented?
593593
/// # // assert_eq!(max, (-max).wrapping_abs());
594-
/// # Ok(())
594+
/// # Some(())
595595
/// # }
596596
/// ```
597597
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -608,11 +608,11 @@ macro_rules! nonzero_signed_operations {
608608
///
609609
/// ```
610610
/// #![feature(nonzero_ops)]
611-
/// # #![feature(try_trait)]
612611
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
613612
#[doc = concat!("# use std::num::", stringify!($Uty), ";")]
614613
///
615-
/// # fn main() -> Result<(), std::option::NoneError> {
614+
/// # fn main() { test().unwrap(); }
615+
/// # fn test() -> Option<()> {
616616
#[doc = concat!("let u_pos = ", stringify!($Uty), "::new(1)?;")]
617617
#[doc = concat!("let i_pos = ", stringify!($Ty), "::new(1)?;")]
618618
#[doc = concat!("let i_neg = ", stringify!($Ty), "::new(-1)?;")]
@@ -624,7 +624,7 @@ macro_rules! nonzero_signed_operations {
624624
/// assert_eq!(u_pos, i_pos.unsigned_abs());
625625
/// assert_eq!(u_pos, i_neg.unsigned_abs());
626626
/// assert_eq!(u_max, i_min.unsigned_abs());
627-
/// # Ok(())
627+
/// # Some(())
628628
/// # }
629629
/// ```
630630
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -660,18 +660,18 @@ macro_rules! nonzero_unsigned_signed_operations {
660660
///
661661
/// ```
662662
/// #![feature(nonzero_ops)]
663-
/// # #![feature(try_trait)]
664663
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
665664
///
666-
/// # fn main() -> Result<(), std::option::NoneError> {
665+
/// # fn main() { test().unwrap(); }
666+
/// # fn test() -> Option<()> {
667667
#[doc = concat!("let two = ", stringify!($Ty), "::new(2)?;")]
668668
#[doc = concat!("let four = ", stringify!($Ty), "::new(4)?;")]
669669
#[doc = concat!("let max = ", stringify!($Ty), "::new(",
670670
stringify!($Int), "::MAX)?;")]
671671
///
672672
/// assert_eq!(Some(four), two.checked_mul(two));
673673
/// assert_eq!(None, max.checked_mul(two));
674-
/// # Ok(())
674+
/// # Some(())
675675
/// # }
676676
/// ```
677677
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -694,18 +694,18 @@ macro_rules! nonzero_unsigned_signed_operations {
694694
///
695695
/// ```
696696
/// #![feature(nonzero_ops)]
697-
/// # #![feature(try_trait)]
698697
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
699698
///
700-
/// # fn main() -> Result<(), std::option::NoneError> {
699+
/// # fn main() { test().unwrap(); }
700+
/// # fn test() -> Option<()> {
701701
#[doc = concat!("let two = ", stringify!($Ty), "::new(2)?;")]
702702
#[doc = concat!("let four = ", stringify!($Ty), "::new(4)?;")]
703703
#[doc = concat!("let max = ", stringify!($Ty), "::new(",
704704
stringify!($Int), "::MAX)?;")]
705705
///
706706
/// assert_eq!(four, two.saturating_mul(two));
707707
/// assert_eq!(max, four.saturating_mul(max));
708-
/// # Ok(())
708+
/// # Some(())
709709
/// # }
710710
/// ```
711711
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -737,15 +737,15 @@ macro_rules! nonzero_unsigned_signed_operations {
737737
///
738738
/// ```
739739
/// #![feature(nonzero_ops)]
740-
/// # #![feature(try_trait)]
741740
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
742741
///
743-
/// # fn main() -> Result<(), std::option::NoneError> {
742+
/// # fn main() { test().unwrap(); }
743+
/// # fn test() -> Option<()> {
744744
#[doc = concat!("let two = ", stringify!($Ty), "::new(2)?;")]
745745
#[doc = concat!("let four = ", stringify!($Ty), "::new(4)?;")]
746746
///
747747
/// assert_eq!(four, unsafe { two.unchecked_mul(two) });
748-
/// # Ok(())
748+
/// # Some(())
749749
/// # }
750750
/// ```
751751
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -763,18 +763,18 @@ macro_rules! nonzero_unsigned_signed_operations {
763763
///
764764
/// ```
765765
/// #![feature(nonzero_ops)]
766-
/// # #![feature(try_trait)]
767766
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
768767
///
769-
/// # fn main() -> Result<(), std::option::NoneError> {
768+
/// # fn main() { test().unwrap(); }
769+
/// # fn test() -> Option<()> {
770770
#[doc = concat!("let three = ", stringify!($Ty), "::new(3)?;")]
771771
#[doc = concat!("let twenty_seven = ", stringify!($Ty), "::new(27)?;")]
772772
#[doc = concat!("let half_max = ", stringify!($Ty), "::new(",
773773
stringify!($Int), "::MAX / 2)?;")]
774774
///
775775
/// assert_eq!(Some(twenty_seven), three.checked_pow(3));
776776
/// assert_eq!(None, half_max.checked_pow(3));
777-
/// # Ok(())
777+
/// # Some(())
778778
/// # }
779779
/// ```
780780
#[unstable(feature = "nonzero_ops", issue = "84186")]
@@ -805,18 +805,18 @@ macro_rules! nonzero_unsigned_signed_operations {
805805
///
806806
/// ```
807807
/// #![feature(nonzero_ops)]
808-
/// # #![feature(try_trait)]
809808
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
810809
///
811-
/// # fn main() -> Result<(), std::option::NoneError> {
810+
/// # fn main() { test().unwrap(); }
811+
/// # fn test() -> Option<()> {
812812
#[doc = concat!("let three = ", stringify!($Ty), "::new(3)?;")]
813813
#[doc = concat!("let twenty_seven = ", stringify!($Ty), "::new(27)?;")]
814814
#[doc = concat!("let max = ", stringify!($Ty), "::new(",
815815
stringify!($Int), "::MAX)?;")]
816816
///
817817
/// assert_eq!(twenty_seven, three.saturating_pow(3));
818818
/// assert_eq!(max, max.saturating_pow(3));
819-
/// # Ok(())
819+
/// # Some(())
820820
/// # }
821821
/// ```
822822
#[unstable(feature = "nonzero_ops", issue = "84186")]

0 commit comments

Comments
 (0)