Skip to content

Commit 5847d0b

Browse files
author
Jonathan Strong
committed
adds links to methods, removes trailing whitespace
1 parent 9307917 commit 5847d0b

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/libcore/option.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,11 @@ impl<T> Option<T> {
338338

339339
/// Returns the contained value or a default.
340340
///
341-
/// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing
342-
/// the result of a function call, it is recommended to use `unwrap_or_else`,
343-
/// which is lazily evaluated.
341+
/// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing
342+
/// the result of a function call, it is recommended to use [`unwrap_or_else`],
343+
/// which is lazily evaluated.
344+
///
345+
/// [`unwrap_or_else`]: #method.unwrap_or_else
344346
///
345347
/// # Examples
346348
///
@@ -456,14 +458,15 @@ impl<T> Option<T> {
456458
/// [`Ok(v)`] and [`None`] to [`Err(err)`].
457459
///
458460
/// Arguments passed to `ok_or` are eagerly evaluated; if you are passing the
459-
/// result of a function call, it is recommended to use `ok_or_else`, which is
461+
/// result of a function call, it is recommended to use [`ok_or_else`], which is
460462
/// lazily evaluated.
461463
///
462464
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
463465
/// [`Ok(v)`]: ../../std/result/enum.Result.html#variant.Ok
464466
/// [`Err(err)`]: ../../std/result/enum.Result.html#variant.Err
465467
/// [`None`]: #variant.None
466468
/// [`Some(v)`]: #variant.Some
469+
/// [`ok_or_else`]: #method.ok_or_else
467470
///
468471
/// # Examples
469472
///
@@ -618,9 +621,11 @@ impl<T> Option<T> {
618621
/// Returns the option if it contains a value, otherwise returns `optb`.
619622
///
620623
/// Arguments passed to `or` are eagerly evaluated; if you are passing the
621-
/// result of a function call, it is recommended to use `or_else`, which is
624+
/// result of a function call, it is recommended to use [`or_else`], which is
622625
/// lazily evaluated.
623626
///
627+
/// [`or_else`]: #method.or_else
628+
///
624629
/// # Examples
625630
///
626631
/// ```

src/libcore/result.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -626,11 +626,12 @@ impl<T, E> Result<T, E> {
626626
/// Returns `res` if the result is [`Err`], otherwise returns the [`Ok`] value of `self`.
627627
///
628628
/// Arguments passed to `or` are eagerly evaluated; if you are passing the
629-
/// result of a function call, it is recommended to use `or_else`, which is
629+
/// result of a function call, it is recommended to use [`or_else`], which is
630630
/// lazily evaluated.
631631
///
632632
/// [`Ok`]: enum.Result.html#variant.Ok
633633
/// [`Err`]: enum.Result.html#variant.Err
634+
/// [`or_else`]: #method.or_else
634635
///
635636
/// # Examples
636637
///
@@ -694,12 +695,13 @@ impl<T, E> Result<T, E> {
694695
/// Unwraps a result, yielding the content of an [`Ok`].
695696
/// Else, it returns `optb`.
696697
///
697-
/// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing
698-
/// the result of a function call, it is recommended to use `unwrap_or_else`,
699-
/// which is lazily evaluated.
698+
/// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing
699+
/// the result of a function call, it is recommended to use [`unwrap_or_else`],
700+
/// which is lazily evaluated.
700701
///
701702
/// [`Ok`]: enum.Result.html#variant.Ok
702703
/// [`Err`]: enum.Result.html#variant.Err
704+
/// [`unwrap_or_else`]: #method.unwrap_or_else
703705
///
704706
/// # Examples
705707
///

0 commit comments

Comments
 (0)