Skip to content

Commit cccb889

Browse files
authored
Rollup merge of #75727 - camelid:intra-doc-links-for-core-result, r=jyn514
Switch to intra-doc links in `core::result` Part of #75080. @rustbot modify labels: A-intra-doc-links T-doc T-rustdoc
2 parents 8665b08 + 5a307cf commit cccb889

File tree

1 file changed

+16
-69
lines changed

1 file changed

+16
-69
lines changed

library/core/src/result.rs

+16-69
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,14 @@
216216
//! [`?`] can only be used in functions that return [`Result`] because of the
217217
//! early return of [`Err`] that it provides.
218218
//!
219-
//! [`expect`]: enum.Result.html#method.expect
219+
//! [`expect`]: Result::expect
220220
//! [`Write`]: ../../std/io/trait.Write.html
221221
//! [`write_all`]: ../../std/io/trait.Write.html#method.write_all
222222
//! [`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
227226
//! [`io::Error`]: ../../std/io/struct.Error.html
228-
//! [`Ok`]: enum.Result.html#variant.Ok
229-
//! [`Err`]: enum.Result.html#variant.Err
230227
231228
#![stable(feature = "rust1", since = "1.0.0")]
232229

@@ -237,9 +234,6 @@ use crate::{convert, fmt};
237234
/// `Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).
238235
///
239236
/// 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
243237
#[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
244238
#[must_use = "this `Result` may be an `Err` variant, which should be handled"]
245239
#[rustc_diagnostic_item = "result_type"]
@@ -267,8 +261,6 @@ impl<T, E> Result<T, E> {
267261

268262
/// Returns `true` if the result is [`Ok`].
269263
///
270-
/// [`Ok`]: enum.Result.html#variant.Ok
271-
///
272264
/// # Examples
273265
///
274266
/// Basic usage:
@@ -290,8 +282,6 @@ impl<T, E> Result<T, E> {
290282

291283
/// Returns `true` if the result is [`Err`].
292284
///
293-
/// [`Err`]: enum.Result.html#variant.Err
294-
///
295285
/// # Examples
296286
///
297287
/// Basic usage:
@@ -378,7 +368,7 @@ impl<T, E> Result<T, E> {
378368
/// Converts `self` into an [`Option<T>`], consuming `self`,
379369
/// and discarding the error, if any.
380370
///
381-
/// [`Option<T>`]: ../../std/option/enum.Option.html
371+
/// [`Option<T>`]: Option
382372
///
383373
/// # Examples
384374
///
@@ -405,7 +395,7 @@ impl<T, E> Result<T, E> {
405395
/// Converts `self` into an [`Option<E>`], consuming `self`,
406396
/// and discarding the success value, if any.
407397
///
408-
/// [`Option<E>`]: ../../std/option/enum.Option.html
398+
/// [`Option<E>`]: Option
409399
///
410400
/// # Examples
411401
///
@@ -497,9 +487,6 @@ impl<T, E> Result<T, E> {
497487
///
498488
/// This function can be used to compose the results of two functions.
499489
///
500-
/// [`Ok`]: enum.Result.html#variant.Ok
501-
/// [`Err`]: enum.Result.html#variant.Err
502-
///
503490
/// # Examples
504491
///
505492
/// Print the numbers on each line of a string multiplied by two.
@@ -530,9 +517,7 @@ impl<T, E> Result<T, E> {
530517
/// the result of a function call, it is recommended to use [`map_or_else`],
531518
/// which is lazily evaluated.
532519
///
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
536521
///
537522
/// # Examples
538523
///
@@ -559,8 +544,6 @@ impl<T, E> Result<T, E> {
559544
/// This function can be used to unpack a successful result
560545
/// while handling an error.
561546
///
562-
/// [`Ok`]: enum.Result.html#variant.Ok
563-
/// [`Err`]: enum.Result.html#variant.Err
564547
///
565548
/// # Examples
566549
///
@@ -590,8 +573,6 @@ impl<T, E> Result<T, E> {
590573
/// This function can be used to pass through a successful result while handling
591574
/// an error.
592575
///
593-
/// [`Ok`]: enum.Result.html#variant.Ok
594-
/// [`Err`]: enum.Result.html#variant.Err
595576
///
596577
/// # Examples
597578
///
@@ -671,8 +652,6 @@ impl<T, E> Result<T, E> {
671652

672653
/// Returns `res` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`.
673654
///
674-
/// [`Ok`]: enum.Result.html#variant.Ok
675-
/// [`Err`]: enum.Result.html#variant.Err
676655
///
677656
/// # Examples
678657
///
@@ -706,8 +685,6 @@ impl<T, E> Result<T, E> {
706685

707686
/// Calls `op` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`.
708687
///
709-
/// [`Ok`]: enum.Result.html#variant.Ok
710-
/// [`Err`]: enum.Result.html#variant.Err
711688
///
712689
/// This function can be used for control flow based on `Result` values.
713690
///
@@ -739,9 +716,7 @@ impl<T, E> Result<T, E> {
739716
/// result of a function call, it is recommended to use [`or_else`], which is
740717
/// lazily evaluated.
741718
///
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
745720
///
746721
/// # Examples
747722
///
@@ -777,8 +752,6 @@ impl<T, E> Result<T, E> {
777752
///
778753
/// This function can be used for control flow based on result values.
779754
///
780-
/// [`Ok`]: enum.Result.html#variant.Ok
781-
/// [`Err`]: enum.Result.html#variant.Err
782755
///
783756
/// # Examples
784757
///
@@ -808,9 +781,7 @@ impl<T, E> Result<T, E> {
808781
/// the result of a function call, it is recommended to use [`unwrap_or_else`],
809782
/// which is lazily evaluated.
810783
///
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
814785
///
815786
/// # Examples
816787
///
@@ -835,7 +806,6 @@ impl<T, E> Result<T, E> {
835806

836807
/// Returns the contained [`Ok`] value or computes it from a closure.
837808
///
838-
/// [`Ok`]: enum.Result.html#variant.Ok
839809
///
840810
/// # Examples
841811
///
@@ -945,8 +915,6 @@ impl<T, E: fmt::Debug> Result<T, E> {
945915
/// Panics if the value is an [`Err`], with a panic message including the
946916
/// passed message, and the content of the [`Err`].
947917
///
948-
/// [`Ok`]: enum.Result.html#variant.Ok
949-
/// [`Err`]: enum.Result.html#variant.Err
950918
///
951919
/// # Examples
952920
///
@@ -973,17 +941,15 @@ impl<T, E: fmt::Debug> Result<T, E> {
973941
/// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or
974942
/// [`unwrap_or_default`].
975943
///
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
979947
///
980948
/// # Panics
981949
///
982950
/// Panics if the value is an [`Err`], with a panic message provided by the
983951
/// [`Err`]'s value.
984952
///
985-
/// [`Ok`]: enum.Result.html#variant.Ok
986-
/// [`Err`]: enum.Result.html#variant.Err
987953
///
988954
/// # Examples
989955
///
@@ -1017,8 +983,6 @@ impl<T: fmt::Debug, E> Result<T, E> {
1017983
/// Panics if the value is an [`Ok`], with a panic message including the
1018984
/// passed message, and the content of the [`Ok`].
1019985
///
1020-
/// [`Ok`]: enum.Result.html#variant.Ok
1021-
/// [`Err`]: enum.Result.html#variant.Err
1022986
///
1023987
/// # Examples
1024988
///
@@ -1045,8 +1009,6 @@ impl<T: fmt::Debug, E> Result<T, E> {
10451009
/// Panics if the value is an [`Ok`], with a custom panic message provided
10461010
/// by the [`Ok`]'s value.
10471011
///
1048-
/// [`Ok`]: enum.Result.html#variant.Ok
1049-
/// [`Err`]: enum.Result.html#variant.Err
10501012
///
10511013
///
10521014
/// # Examples
@@ -1095,10 +1057,8 @@ impl<T: Default, E> Result<T, E> {
10951057
/// assert_eq!(0, bad_year);
10961058
/// ```
10971059
///
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
11021062
#[inline]
11031063
#[stable(feature = "result_unwrap_or_default", since = "1.16.0")]
11041064
pub fn unwrap_or_default(self) -> T {
@@ -1119,9 +1079,7 @@ impl<T, E: Into<!>> Result<T, E> {
11191079
/// to compile if the error type of the `Result` is later changed
11201080
/// to an error that can actually occur.
11211081
///
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
11251083
///
11261084
/// # Examples
11271085
///
@@ -1343,10 +1301,6 @@ impl<'a, T, E> IntoIterator for &'a mut Result<T, E> {
13431301
/// The iterator yields one value if the result is [`Ok`], otherwise none.
13441302
///
13451303
/// 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
13501304
#[derive(Debug)]
13511305
#[stable(feature = "rust1", since = "1.0.0")]
13521306
pub struct Iter<'a, T: 'a> {
@@ -1396,10 +1350,6 @@ impl<T> Clone for Iter<'_, T> {
13961350
/// An iterator over a mutable reference to the [`Ok`] variant of a [`Result`].
13971351
///
13981352
/// 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
14031353
#[derive(Debug)]
14041354
#[stable(feature = "rust1", since = "1.0.0")]
14051355
pub struct IterMut<'a, T: 'a> {
@@ -1445,10 +1395,7 @@ unsafe impl<A> TrustedLen for IterMut<'_, A> {}
14451395
/// This struct is created by the [`into_iter`] method on
14461396
/// [`Result`] (provided by the [`IntoIterator`] trait).
14471397
///
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
14521399
#[derive(Clone, Debug)]
14531400
#[stable(feature = "rust1", since = "1.0.0")]
14541401
pub struct IntoIter<T> {

0 commit comments

Comments
 (0)