Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d36e3e2

Browse files
committedAug 23, 2020
Use intra-doc-links in core::{char, macros, fmt}
1 parent 9d606d9 commit d36e3e2

File tree

3 files changed

+30
-114
lines changed

3 files changed

+30
-114
lines changed
 

‎library/core/src/char/mod.rs

+5-11
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ const MAX_THREE_B: u32 = 0x10000;
9494
/// Point], but only ones within a certain range. `MAX` is the highest valid
9595
/// code point that's a valid [Unicode Scalar Value].
9696
///
97-
/// [`char`]: ../../std/primitive.char.html
9897
/// [Unicode Scalar Value]: http://www.unicode.org/glossary/#unicode_scalar_value
9998
/// [Code Point]: http://www.unicode.org/glossary/#code_point
10099
#[stable(feature = "rust1", since = "1.0.0")]
@@ -114,8 +113,7 @@ pub const REPLACEMENT_CHARACTER: char = char::REPLACEMENT_CHARACTER;
114113
/// This `struct` is created by the [`escape_unicode`] method on [`char`]. See
115114
/// its documentation for more.
116115
///
117-
/// [`escape_unicode`]: ../../std/primitive.char.html#method.escape_unicode
118-
/// [`char`]: ../../std/primitive.char.html
116+
/// [`escape_unicode`]: char::escape_unicode
119117
#[derive(Clone, Debug)]
120118
#[stable(feature = "rust1", since = "1.0.0")]
121119
pub struct EscapeUnicode {
@@ -236,8 +234,7 @@ impl fmt::Display for EscapeUnicode {
236234
/// This `struct` is created by the [`escape_default`] method on [`char`]. See
237235
/// its documentation for more.
238236
///
239-
/// [`escape_default`]: ../../std/primitive.char.html#method.escape_default
240-
/// [`char`]: ../../std/primitive.char.html
237+
/// [`escape_default`]: char::escape_default
241238
#[derive(Clone, Debug)]
242239
#[stable(feature = "rust1", since = "1.0.0")]
243240
pub struct EscapeDefault {
@@ -345,8 +342,7 @@ impl fmt::Display for EscapeDefault {
345342
/// This `struct` is created by the [`escape_debug`] method on [`char`]. See its
346343
/// documentation for more.
347344
///
348-
/// [`escape_debug`]: ../../std/primitive.char.html#method.escape_debug
349-
/// [`char`]: ../../std/primitive.char.html
345+
/// [`escape_debug`]: char::escape_debug
350346
#[stable(feature = "char_escape_debug", since = "1.20.0")]
351347
#[derive(Clone, Debug)]
352348
pub struct EscapeDebug(EscapeDefault);
@@ -380,8 +376,7 @@ impl fmt::Display for EscapeDebug {
380376
/// This `struct` is created by the [`to_lowercase`] method on [`char`]. See
381377
/// its documentation for more.
382378
///
383-
/// [`to_lowercase`]: ../../std/primitive.char.html#method.to_lowercase
384-
/// [`char`]: ../../std/primitive.char.html
379+
/// [`to_lowercase`]: char::to_lowercase
385380
#[stable(feature = "rust1", since = "1.0.0")]
386381
#[derive(Debug, Clone)]
387382
pub struct ToLowercase(CaseMappingIter);
@@ -408,8 +403,7 @@ impl ExactSizeIterator for ToLowercase {}
408403
/// This `struct` is created by the [`to_uppercase`] method on [`char`]. See
409404
/// its documentation for more.
410405
///
411-
/// [`to_uppercase`]: ../../std/primitive.char.html#method.to_uppercase
412-
/// [`char`]: ../../std/primitive.char.html
406+
/// [`to_uppercase`]: char::to_uppercase
413407
#[stable(feature = "rust1", since = "1.0.0")]
414408
#[derive(Debug, Clone)]
415409
pub struct ToUppercase(CaseMappingIter);

‎library/core/src/fmt/mod.rs

+14-50
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ pub trait Write {
117117
///
118118
/// This function will return an instance of [`Error`] on error.
119119
///
120-
/// [`Error`]: struct.Error.html
121-
///
122120
/// # Examples
123121
///
124122
/// ```
@@ -146,9 +144,6 @@ pub trait Write {
146144
///
147145
/// This function will return an instance of [`Error`] on error.
148146
///
149-
/// [`char`]: ../../std/primitive.char.html
150-
/// [`Error`]: struct.Error.html
151-
///
152147
/// # Examples
153148
///
154149
/// ```
@@ -218,9 +213,6 @@ impl<W: Write + ?Sized> Write for &mut W {
218213
/// To interact with a `Formatter`, you'll call various methods to change the
219214
/// various options related to formatting. For examples, please see the
220215
/// documentation of the methods defined on `Formatter` below.
221-
///
222-
/// [`Debug`]: trait.Debug.html
223-
/// [`Display`]: trait.Display.html
224216
#[allow(missing_debug_implementations)]
225217
#[stable(feature = "rust1", since = "1.0.0")]
226218
pub struct Formatter<'a> {
@@ -378,7 +370,7 @@ impl<'a> Arguments<'a> {
378370
///
379371
/// The [`format_args!`] macro will safely create an instance of this structure.
380372
/// The macro validates the format string at compile-time so usage of the
381-
/// [`write`] and [`format`] functions can be safely performed.
373+
/// [`write()`] and [`format()`] functions can be safely performed.
382374
///
383375
/// You can use the `Arguments<'a>` that [`format_args!`] returns in `Debug`
384376
/// and `Display` contexts as seen below. The example also shows that `Debug`
@@ -392,9 +384,7 @@ impl<'a> Arguments<'a> {
392384
/// assert_eq!(display, debug);
393385
/// ```
394386
///
395-
/// [`format_args!`]: ../../std/macro.format_args.html
396-
/// [`format`]: ../../std/fmt/fn.format.html
397-
/// [`write`]: ../../std/fmt/fn.write.html
387+
/// [`format()`]: ../../std/fmt/fn.format.html
398388
#[stable(feature = "rust1", since = "1.0.0")]
399389
#[derive(Copy, Clone)]
400390
pub struct Arguments<'a> {
@@ -472,9 +462,7 @@ impl Display for Arguments<'_> {
472462
///
473463
/// When used with the alternate format specifier `#?`, the output is pretty-printed.
474464
///
475-
/// For more information on formatters, see [the module-level documentation][module].
476-
///
477-
/// [module]: ../../std/fmt/index.html
465+
/// For more information on formatters, see [the module-level documentation][self].
478466
///
479467
/// This trait can be used with `#[derive]` if all fields implement `Debug`. When
480468
/// `derive`d for structs, it will use the name of the `struct`, then `{`, then a
@@ -535,8 +523,7 @@ impl Display for Arguments<'_> {
535523
/// `Debug` implementations using either `derive` or the debug builder API
536524
/// on [`Formatter`] support pretty-printing using the alternate flag: `{:#?}`.
537525
///
538-
/// [`debug_struct`]: ../../std/fmt/struct.Formatter.html#method.debug_struct
539-
/// [`Formatter`]: ../../std/fmt/struct.Formatter.html
526+
/// [`debug_struct`]: Formatter::debug_struct
540527
///
541528
/// Pretty-printing with `#?`:
542529
///
@@ -618,14 +605,10 @@ pub use macros::Debug;
618605

619606
/// Format trait for an empty format, `{}`.
620607
///
621-
/// `Display` is similar to [`Debug`][debug], but `Display` is for user-facing
608+
/// `Display` is similar to [`Debug`], but `Display` is for user-facing
622609
/// output, and so cannot be derived.
623610
///
624-
/// [debug]: trait.Debug.html
625-
///
626-
/// For more information on formatters, see [the module-level documentation][module].
627-
///
628-
/// [module]: ../../std/fmt/index.html
611+
/// For more information on formatters, see [the module-level documentation][self].
629612
///
630613
/// # Examples
631614
///
@@ -697,9 +680,7 @@ pub trait Display {
697680
///
698681
/// The alternate flag, `#`, adds a `0o` in front of the output.
699682
///
700-
/// For more information on formatters, see [the module-level documentation][module].
701-
///
702-
/// [module]: ../../std/fmt/index.html
683+
/// For more information on formatters, see [the module-level documentation][self].
703684
///
704685
/// # Examples
705686
///
@@ -751,7 +732,7 @@ pub trait Octal {
751732
///
752733
/// The alternate flag, `#`, adds a `0b` in front of the output.
753734
///
754-
/// For more information on formatters, see [the module-level documentation][module].
735+
/// For more information on formatters, see [the module-level documentation][self].
755736
///
756737
/// # Examples
757738
///
@@ -790,12 +771,6 @@ pub trait Octal {
790771
/// "l as binary is: 0b000000000000000000000001101011"
791772
/// );
792773
/// ```
793-
///
794-
/// [module]: ../../std/fmt/index.html
795-
/// [`i8`]: ../../std/primitive.i8.html
796-
/// [`i128`]: ../../std/primitive.i128.html
797-
/// [`isize`]: ../../std/primitive.isize.html
798-
/// [`i32`]: ../../std/primitive.i32.html
799774
#[stable(feature = "rust1", since = "1.0.0")]
800775
pub trait Binary {
801776
/// Formats the value using the given formatter.
@@ -813,9 +788,7 @@ pub trait Binary {
813788
///
814789
/// The alternate flag, `#`, adds a `0x` in front of the output.
815790
///
816-
/// For more information on formatters, see [the module-level documentation][module].
817-
///
818-
/// [module]: ../../std/fmt/index.html
791+
/// For more information on formatters, see [the module-level documentation][self].
819792
///
820793
/// # Examples
821794
///
@@ -868,9 +841,7 @@ pub trait LowerHex {
868841
///
869842
/// The alternate flag, `#`, adds a `0x` in front of the output.
870843
///
871-
/// For more information on formatters, see [the module-level documentation][module].
872-
///
873-
/// [module]: ../../std/fmt/index.html
844+
/// For more information on formatters, see [the module-level documentation][self].
874845
///
875846
/// # Examples
876847
///
@@ -918,9 +889,7 @@ pub trait UpperHex {
918889
/// The `Pointer` trait should format its output as a memory location. This is commonly presented
919890
/// as hexadecimal.
920891
///
921-
/// For more information on formatters, see [the module-level documentation][module].
922-
///
923-
/// [module]: ../../std/fmt/index.html
892+
/// For more information on formatters, see [the module-level documentation][self].
924893
///
925894
/// # Examples
926895
///
@@ -967,9 +936,7 @@ pub trait Pointer {
967936
///
968937
/// The `LowerExp` trait should format its output in scientific notation with a lower-case `e`.
969938
///
970-
/// For more information on formatters, see [the module-level documentation][module].
971-
///
972-
/// [module]: ../../std/fmt/index.html
939+
/// For more information on formatters, see [the module-level documentation][self].
973940
///
974941
/// # Examples
975942
///
@@ -1018,9 +985,7 @@ pub trait LowerExp {
1018985
///
1019986
/// The `UpperExp` trait should format its output in scientific notation with an upper-case `E`.
1020987
///
1021-
/// For more information on formatters, see [the module-level documentation][module].
1022-
///
1023-
/// [module]: ../../std/fmt/index.html
988+
/// For more information on formatters, see [the module-level documentation][self].
1024989
///
1025990
/// # Examples
1026991
///
@@ -1812,8 +1777,7 @@ impl<'a> Formatter<'a> {
18121777
/// Creates a [`DebugStruct`] builder designed to assist with creation of
18131778
/// [`fmt::Debug`] implementations for structs.
18141779
///
1815-
/// [`DebugStruct`]: ../../std/fmt/struct.DebugStruct.html
1816-
/// [`fmt::Debug`]: ../../std/fmt/trait.Debug.html
1780+
/// [`fmt::Debug`]: self::Debug
18171781
///
18181782
/// # Examples
18191783
///

‎library/core/src/macros/mod.rs

+11-53
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ macro_rules! panic {
2828
/// Like [`assert!`], this macro has a second form, where a custom
2929
/// panic message can be provided.
3030
///
31-
/// [`PartialEq`]: cmp/trait.PartialEq.html
32-
/// [`assert!`]: macro.assert.html
33-
///
3431
/// # Examples
3532
///
3633
/// ```
@@ -85,9 +82,6 @@ macro_rules! assert_eq {
8582
/// Like [`assert!`], this macro has a second form, where a custom
8683
/// panic message can be provided.
8784
///
88-
/// [`PartialEq`]: cmp/trait.PartialEq.html
89-
/// [`assert!`]: macro.assert.html
90-
///
9185
/// # Examples
9286
///
9387
/// ```
@@ -158,9 +152,6 @@ macro_rules! assert_ne {
158152
/// with `debug_assert!` is thus only encouraged after thorough profiling, and
159153
/// more importantly, only in safe code!
160154
///
161-
/// [`panic!`]: macro.panic.html
162-
/// [`assert!`]: macro.assert.html
163-
///
164155
/// # Examples
165156
///
166157
/// ```
@@ -196,8 +187,6 @@ macro_rules! debug_assert {
196187
/// expensive to be present in a release build but may be helpful during
197188
/// development. The result of expanding `debug_assert_eq!` is always type checked.
198189
///
199-
/// [`assert_eq!`]: ../std/macro.assert_eq.html
200-
///
201190
/// # Examples
202191
///
203192
/// ```
@@ -223,8 +212,6 @@ macro_rules! debug_assert_eq {
223212
/// expensive to be present in a release build but may be helpful during
224213
/// development. The result of expanding `debug_assert_ne!` is always type checked.
225214
///
226-
/// [`assert_ne!`]: ../std/macro.assert_ne.html
227-
///
228215
/// # Examples
229216
///
230217
/// ```
@@ -282,8 +269,6 @@ macro_rules! matches {
282269
/// Because of the early return, `try!` can only be used in functions that
283270
/// return [`Result`].
284271
///
285-
/// [`Result`]: ../std/result/enum.Result.html
286-
///
287272
/// # Examples
288273
///
289274
/// ```
@@ -354,10 +339,10 @@ macro_rules! r#try {
354339
///
355340
/// See [`std::fmt`] for more information on the format string syntax.
356341
///
357-
/// [`std::fmt`]: ../std/fmt/index.html
358-
/// [`std::fmt::Write`]: ../std/fmt/trait.Write.html
342+
/// [`std::fmt`]: crate::fmt
343+
/// [`std::fmt::Write`]: crate::fmt::Write
359344
/// [`std::io::Write`]: ../std/io/trait.Write.html
360-
/// [`std::fmt::Result`]: ../std/fmt/type.Result.html
345+
/// [`std::fmt::Result`]: crate::fmt::Result
361346
/// [`io::Result`]: ../std/io/type.Result.html
362347
///
363348
/// # Examples
@@ -426,9 +411,7 @@ macro_rules! write {
426411
/// For more information, see [`write!`]. For information on the format string syntax, see
427412
/// [`std::fmt`].
428413
///
429-
/// [`write!`]: macro.write.html
430-
/// [`std::fmt`]: ../std/fmt/index.html
431-
///
414+
/// [`std::fmt`]: crate::fmt
432415
///
433416
/// # Examples
434417
///
@@ -494,16 +477,12 @@ macro_rules! writeln {
494477
/// The unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which
495478
/// will cause undefined behavior if the code is reached.
496479
///
497-
/// [`panic!`]: ../std/macro.panic.html
498-
/// [`unreachable_unchecked`]: ../std/hint/fn.unreachable_unchecked.html
499-
/// [`std::hint`]: ../std/hint/index.html
480+
/// [`unreachable_unchecked`]: crate::hint::unreachable_unchecked
500481
///
501482
/// # Panics
502483
///
503484
/// This will always [`panic!`]
504485
///
505-
/// [`panic!`]: ../std/macro.panic.html
506-
///
507486
/// # Examples
508487
///
509488
/// Match arms:
@@ -637,8 +616,6 @@ macro_rules! unimplemented {
637616
/// implemented", `unimplemented!` makes no such claims. Its message is "not implemented".
638617
/// Also some IDEs will mark `todo!`s.
639618
///
640-
/// [`unimplemented!`]: macro.unimplemented.html
641-
///
642619
/// # Panics
643620
///
644621
/// This will always [panic!](macro.panic.html)
@@ -730,8 +707,6 @@ pub(crate) mod builtin {
730707
/// #[cfg(not(any(feature = "foo", feature = "bar")))]
731708
/// compile_error!("Either feature \"foo\" or \"bar\" must be enabled for this crate.");
732709
/// ```
733-
///
734-
/// [`panic!`]: ../std/macro.panic.html
735710
#[stable(feature = "compile_error_macro", since = "1.20.0")]
736711
#[rustc_builtin_macro]
737712
#[macro_export]
@@ -769,12 +744,11 @@ pub(crate) mod builtin {
769744
///
770745
/// For more information, see the documentation in [`std::fmt`].
771746
///
772-
/// [`Display`]: ../std/fmt/trait.Display.html
773-
/// [`Debug`]: ../std/fmt/trait.Debug.html
774-
/// [`fmt::Arguments`]: ../std/fmt/struct.Arguments.html
775-
/// [`std::fmt`]: ../std/fmt/index.html
747+
/// [`Display`]: crate::fmt::Display
748+
/// [`Debug`]: crate::fmt::Debug
749+
/// [`fmt::Arguments`]: crate::fmt::Arguments
750+
/// [`std::fmt`]: crate::fmt
776751
/// [`format!`]: ../std/macro.format.html
777-
/// [`write!`]: ../std/macro.write.html
778752
/// [`println!`]: ../std/macro.println.html
779753
///
780754
/// # Examples
@@ -818,8 +792,6 @@ pub(crate) mod builtin {
818792
/// will be emitted. To not emit a compile error, use the [`option_env!`]
819793
/// macro instead.
820794
///
821-
/// [`option_env!`]: ../std/macro.option_env.html
822-
///
823795
/// # Examples
824796
///
825797
/// ```
@@ -854,13 +826,11 @@ pub(crate) mod builtin {
854826
/// expand into an expression of type `Option<&'static str>` whose value is
855827
/// `Some` of the value of the environment variable. If the environment
856828
/// variable is not present, then this will expand to `None`. See
857-
/// [`Option<T>`][option] for more information on this type.
829+
/// [`Option<T>`][Option] for more information on this type.
858830
///
859831
/// A compile time error is never emitted when using this macro regardless
860832
/// of whether the environment variable is present or not.
861833
///
862-
/// [option]: ../std/option/enum.Option.html
863-
///
864834
/// # Examples
865835
///
866836
/// ```
@@ -946,9 +916,6 @@ pub(crate) mod builtin {
946916
/// but rather the first macro invocation leading up to the invocation
947917
/// of the `line!` macro.
948918
///
949-
/// [`column!`]: macro.column.html
950-
/// [`file!`]: macro.file.html
951-
///
952919
/// # Examples
953920
///
954921
/// ```
@@ -976,9 +943,6 @@ pub(crate) mod builtin {
976943
/// but rather the first macro invocation leading up to the invocation
977944
/// of the `column!` macro.
978945
///
979-
/// [`line!`]: macro.line.html
980-
/// [`file!`]: macro.file.html
981-
///
982946
/// # Examples
983947
///
984948
/// ```
@@ -999,15 +963,11 @@ pub(crate) mod builtin {
999963
/// With [`line!`] and [`column!`], these macros provide debugging information for
1000964
/// developers about the location within the source.
1001965
///
1002-
///
1003966
/// The expanded expression has type `&'static str`, and the returned file
1004967
/// is not the invocation of the `file!` macro itself, but rather the
1005968
/// first macro invocation leading up to the invocation of the `file!`
1006969
/// macro.
1007970
///
1008-
/// [`line!`]: macro.line.html
1009-
/// [`column!`]: macro.column.html
1010-
///
1011971
/// # Examples
1012972
///
1013973
/// ```
@@ -1258,9 +1218,7 @@ pub(crate) mod builtin {
12581218
/// be provided with or without arguments for formatting. See [`std::fmt`]
12591219
/// for syntax for this form.
12601220
///
1261-
/// [`panic!`]: macro.panic.html
1262-
/// [`debug_assert!`]: macro.debug_assert.html
1263-
/// [`std::fmt`]: ../std/fmt/index.html
1221+
/// [`std::fmt`]: crate::fmt
12641222
///
12651223
/// # Examples
12661224
///

0 commit comments

Comments
 (0)
Please sign in to comment.