216
216
//! [`?`] can only be used in functions that return [`Result`] because of the
217
217
//! early return of [`Err`] that it provides.
218
218
//!
219
- //! [`expect`]: enum. Result.html#method. expect
219
+ //! [`expect`]: Result:: expect
220
220
//! [`Write`]: ../../std/io/trait.Write.html
221
221
//! [`write_all`]: ../../std/io/trait.Write.html#method.write_all
222
222
//! [`io::Result`]: ../../std/io/type.Result.html
223
- //! [`?`]: ../../std/macro.try.html
224
- //! [`Result`]: enum.Result.html
225
- //! [`Ok(T)`]: enum.Result.html#variant.Ok
226
- //! [`Err(E)`]: enum.Result.html#variant.Err
223
+ //! [`?`]: crate::ops::Try
224
+ //! [`Ok(T)`]: Ok
225
+ //! [`Err(E)`]: Err
227
226
//! [`io::Error`]: ../../std/io/struct.Error.html
228
- //! [`Ok`]: enum.Result.html#variant.Ok
229
- //! [`Err`]: enum.Result.html#variant.Err
230
227
231
228
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
232
229
@@ -237,9 +234,6 @@ use crate::{convert, fmt};
237
234
/// `Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).
238
235
///
239
236
/// See the [`std::result`](index.html) module documentation for details.
240
- ///
241
- /// [`Ok`]: enum.Result.html#variant.Ok
242
- /// [`Err`]: enum.Result.html#variant.Err
243
237
#[ derive( Copy , PartialEq , PartialOrd , Eq , Ord , Debug , Hash ) ]
244
238
#[ must_use = "this `Result` may be an `Err` variant, which should be handled" ]
245
239
#[ rustc_diagnostic_item = "result_type" ]
@@ -267,8 +261,6 @@ impl<T, E> Result<T, E> {
267
261
268
262
/// Returns `true` if the result is [`Ok`].
269
263
///
270
- /// [`Ok`]: enum.Result.html#variant.Ok
271
- ///
272
264
/// # Examples
273
265
///
274
266
/// Basic usage:
@@ -290,8 +282,6 @@ impl<T, E> Result<T, E> {
290
282
291
283
/// Returns `true` if the result is [`Err`].
292
284
///
293
- /// [`Err`]: enum.Result.html#variant.Err
294
- ///
295
285
/// # Examples
296
286
///
297
287
/// Basic usage:
@@ -378,7 +368,7 @@ impl<T, E> Result<T, E> {
378
368
/// Converts `self` into an [`Option<T>`], consuming `self`,
379
369
/// and discarding the error, if any.
380
370
///
381
- /// [`Option<T>`]: ../../std/option/enum. Option.html
371
+ /// [`Option<T>`]: Option
382
372
///
383
373
/// # Examples
384
374
///
@@ -405,7 +395,7 @@ impl<T, E> Result<T, E> {
405
395
/// Converts `self` into an [`Option<E>`], consuming `self`,
406
396
/// and discarding the success value, if any.
407
397
///
408
- /// [`Option<E>`]: ../../std/option/enum. Option.html
398
+ /// [`Option<E>`]: Option
409
399
///
410
400
/// # Examples
411
401
///
@@ -497,9 +487,6 @@ impl<T, E> Result<T, E> {
497
487
///
498
488
/// This function can be used to compose the results of two functions.
499
489
///
500
- /// [`Ok`]: enum.Result.html#variant.Ok
501
- /// [`Err`]: enum.Result.html#variant.Err
502
- ///
503
490
/// # Examples
504
491
///
505
492
/// Print the numbers on each line of a string multiplied by two.
@@ -530,9 +517,7 @@ impl<T, E> Result<T, E> {
530
517
/// the result of a function call, it is recommended to use [`map_or_else`],
531
518
/// which is lazily evaluated.
532
519
///
533
- /// [`map_or_else`]: #method.map_or_else
534
- /// [`Ok`]: enum.Result.html#variant.Ok
535
- /// [`Err`]: enum.Result.html#variant.Err
520
+ /// [`map_or_else`]: Result::map_or_else
536
521
///
537
522
/// # Examples
538
523
///
@@ -559,8 +544,6 @@ impl<T, E> Result<T, E> {
559
544
/// This function can be used to unpack a successful result
560
545
/// while handling an error.
561
546
///
562
- /// [`Ok`]: enum.Result.html#variant.Ok
563
- /// [`Err`]: enum.Result.html#variant.Err
564
547
///
565
548
/// # Examples
566
549
///
@@ -590,8 +573,6 @@ impl<T, E> Result<T, E> {
590
573
/// This function can be used to pass through a successful result while handling
591
574
/// an error.
592
575
///
593
- /// [`Ok`]: enum.Result.html#variant.Ok
594
- /// [`Err`]: enum.Result.html#variant.Err
595
576
///
596
577
/// # Examples
597
578
///
@@ -671,8 +652,6 @@ impl<T, E> Result<T, E> {
671
652
672
653
/// Returns `res` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`.
673
654
///
674
- /// [`Ok`]: enum.Result.html#variant.Ok
675
- /// [`Err`]: enum.Result.html#variant.Err
676
655
///
677
656
/// # Examples
678
657
///
@@ -706,8 +685,6 @@ impl<T, E> Result<T, E> {
706
685
707
686
/// Calls `op` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`.
708
687
///
709
- /// [`Ok`]: enum.Result.html#variant.Ok
710
- /// [`Err`]: enum.Result.html#variant.Err
711
688
///
712
689
/// This function can be used for control flow based on `Result` values.
713
690
///
@@ -739,9 +716,7 @@ impl<T, E> Result<T, E> {
739
716
/// result of a function call, it is recommended to use [`or_else`], which is
740
717
/// lazily evaluated.
741
718
///
742
- /// [`Ok`]: enum.Result.html#variant.Ok
743
- /// [`Err`]: enum.Result.html#variant.Err
744
- /// [`or_else`]: #method.or_else
719
+ /// [`or_else`]: Result::or_else
745
720
///
746
721
/// # Examples
747
722
///
@@ -777,8 +752,6 @@ impl<T, E> Result<T, E> {
777
752
///
778
753
/// This function can be used for control flow based on result values.
779
754
///
780
- /// [`Ok`]: enum.Result.html#variant.Ok
781
- /// [`Err`]: enum.Result.html#variant.Err
782
755
///
783
756
/// # Examples
784
757
///
@@ -808,9 +781,7 @@ impl<T, E> Result<T, E> {
808
781
/// the result of a function call, it is recommended to use [`unwrap_or_else`],
809
782
/// which is lazily evaluated.
810
783
///
811
- /// [`Ok`]: enum.Result.html#variant.Ok
812
- /// [`Err`]: enum.Result.html#variant.Err
813
- /// [`unwrap_or_else`]: #method.unwrap_or_else
784
+ /// [`unwrap_or_else`]: Result::unwrap_or_else
814
785
///
815
786
/// # Examples
816
787
///
@@ -835,7 +806,6 @@ impl<T, E> Result<T, E> {
835
806
836
807
/// Returns the contained [`Ok`] value or computes it from a closure.
837
808
///
838
- /// [`Ok`]: enum.Result.html#variant.Ok
839
809
///
840
810
/// # Examples
841
811
///
@@ -945,8 +915,6 @@ impl<T, E: fmt::Debug> Result<T, E> {
945
915
/// Panics if the value is an [`Err`], with a panic message including the
946
916
/// passed message, and the content of the [`Err`].
947
917
///
948
- /// [`Ok`]: enum.Result.html#variant.Ok
949
- /// [`Err`]: enum.Result.html#variant.Err
950
918
///
951
919
/// # Examples
952
920
///
@@ -973,17 +941,15 @@ impl<T, E: fmt::Debug> Result<T, E> {
973
941
/// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or
974
942
/// [`unwrap_or_default`].
975
943
///
976
- /// [`unwrap_or`]: #method. unwrap_or
977
- /// [`unwrap_or_else`]: #method. unwrap_or_else
978
- /// [`unwrap_or_default`]: #method. unwrap_or_default
944
+ /// [`unwrap_or`]: Result:: unwrap_or
945
+ /// [`unwrap_or_else`]: Result:: unwrap_or_else
946
+ /// [`unwrap_or_default`]: Result:: unwrap_or_default
979
947
///
980
948
/// # Panics
981
949
///
982
950
/// Panics if the value is an [`Err`], with a panic message provided by the
983
951
/// [`Err`]'s value.
984
952
///
985
- /// [`Ok`]: enum.Result.html#variant.Ok
986
- /// [`Err`]: enum.Result.html#variant.Err
987
953
///
988
954
/// # Examples
989
955
///
@@ -1017,8 +983,6 @@ impl<T: fmt::Debug, E> Result<T, E> {
1017
983
/// Panics if the value is an [`Ok`], with a panic message including the
1018
984
/// passed message, and the content of the [`Ok`].
1019
985
///
1020
- /// [`Ok`]: enum.Result.html#variant.Ok
1021
- /// [`Err`]: enum.Result.html#variant.Err
1022
986
///
1023
987
/// # Examples
1024
988
///
@@ -1045,8 +1009,6 @@ impl<T: fmt::Debug, E> Result<T, E> {
1045
1009
/// Panics if the value is an [`Ok`], with a custom panic message provided
1046
1010
/// by the [`Ok`]'s value.
1047
1011
///
1048
- /// [`Ok`]: enum.Result.html#variant.Ok
1049
- /// [`Err`]: enum.Result.html#variant.Err
1050
1012
///
1051
1013
///
1052
1014
/// # Examples
@@ -1095,10 +1057,8 @@ impl<T: Default, E> Result<T, E> {
1095
1057
/// assert_eq!(0, bad_year);
1096
1058
/// ```
1097
1059
///
1098
- /// [`parse`]: ../../std/primitive.str.html#method.parse
1099
- /// [`FromStr`]: ../../std/str/trait.FromStr.html
1100
- /// [`Ok`]: enum.Result.html#variant.Ok
1101
- /// [`Err`]: enum.Result.html#variant.Err
1060
+ /// [`parse`]: str::parse
1061
+ /// [`FromStr`]: crate::str::FromStr
1102
1062
#[ inline]
1103
1063
#[ stable( feature = "result_unwrap_or_default" , since = "1.16.0" ) ]
1104
1064
pub fn unwrap_or_default ( self ) -> T {
@@ -1119,9 +1079,7 @@ impl<T, E: Into<!>> Result<T, E> {
1119
1079
/// to compile if the error type of the `Result` is later changed
1120
1080
/// to an error that can actually occur.
1121
1081
///
1122
- /// [`Ok`]: enum.Result.html#variant.Ok
1123
- /// [`Err`]: enum.Result.html#variant.Err
1124
- /// [`unwrap`]: enum.Result.html#method.unwrap
1082
+ /// [`unwrap`]: Result::unwrap
1125
1083
///
1126
1084
/// # Examples
1127
1085
///
@@ -1343,10 +1301,6 @@ impl<'a, T, E> IntoIterator for &'a mut Result<T, E> {
1343
1301
/// The iterator yields one value if the result is [`Ok`], otherwise none.
1344
1302
///
1345
1303
/// Created by [`Result::iter`].
1346
- ///
1347
- /// [`Ok`]: enum.Result.html#variant.Ok
1348
- /// [`Result`]: enum.Result.html
1349
- /// [`Result::iter`]: enum.Result.html#method.iter
1350
1304
#[ derive( Debug ) ]
1351
1305
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1352
1306
pub struct Iter < ' a , T : ' a > {
@@ -1396,10 +1350,6 @@ impl<T> Clone for Iter<'_, T> {
1396
1350
/// An iterator over a mutable reference to the [`Ok`] variant of a [`Result`].
1397
1351
///
1398
1352
/// Created by [`Result::iter_mut`].
1399
- ///
1400
- /// [`Ok`]: enum.Result.html#variant.Ok
1401
- /// [`Result`]: enum.Result.html
1402
- /// [`Result::iter_mut`]: enum.Result.html#method.iter_mut
1403
1353
#[ derive( Debug ) ]
1404
1354
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1405
1355
pub struct IterMut < ' a , T : ' a > {
@@ -1445,10 +1395,7 @@ unsafe impl<A> TrustedLen for IterMut<'_, A> {}
1445
1395
/// This struct is created by the [`into_iter`] method on
1446
1396
/// [`Result`] (provided by the [`IntoIterator`] trait).
1447
1397
///
1448
- /// [`Ok`]: enum.Result.html#variant.Ok
1449
- /// [`Result`]: enum.Result.html
1450
- /// [`into_iter`]: ../iter/trait.IntoIterator.html#tymethod.into_iter
1451
- /// [`IntoIterator`]: ../iter/trait.IntoIterator.html
1398
+ /// [`into_iter`]: IntoIterator::into_iter
1452
1399
#[ derive( Clone , Debug ) ]
1453
1400
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1454
1401
pub struct IntoIter < T > {
0 commit comments