-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
a-commentsonly-with-optionrequires a non-default option value to reproducerequires a non-default option value to reproduce
Description
rustfmt with wrap_comments
enabled is mangling reference-style intra-doc links by line wrapping them.
A comment like this:
/// Check out [my other struct] ([`Bananas`]) and [the method it has].
///
/// [my other struct]: a_long_name::b_long_name::c_long_name::d_long_name::e_long_name::f_long_name::Apples
/// [`Bananas`]: a_long_name::b_long_name::c_long_name::d_long_name::e_long_name::Bananas::fantastic()
/// [the method it has]: a_long_name::b_long_name::c_long_name::d_long_name::e_long_name::Bananas::fantastic()
pub struct A;
Is wrapped into:
/// Check out [my other struct] ([`Bananas`]) and [the method it has].
///
/// [my other struct]:
/// a_long_name::b_long_name::c_long_name::d_long_name::e_long_name::
/// f_long_name::Apples [`Bananas`]:
/// a_long_name::b_long_name::c_long_name::d_long_name::e_long_name::Bananas::
/// fantastic() [the method it has]:
/// a_long_name::b_long_name::c_long_name::d_long_name::e_long_name::Bananas::
/// fantastic()
pub struct A;
I would have expected rustfmt to leave the reference links alone, the wrapped comment makes cargo doc
unhappy.
cargo doc output
doctest % cargo doc
Documenting doctest v0.1.0 (/Users/dom/Desktop/doctest)
warning: unresolved link to `Bananas`
--> src/lib.rs:20:36
|
20 | /// Check out [my other struct] ([`Bananas`]) and [the method it has].
| ^^^^^^^ no item named `Bananas` in scope
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: unresolved link to `a_long_name::b_long_name::c_long_name::d_long_name::e_long_name::`
--> src/lib.rs:23:5
|
23 | /// a_long_name::b_long_name::c_long_name::d_long_name::e_long_name::
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `` in module `e_long_name`
warning: unresolved link to `Bananas`
--> src/lib.rs:24:27
|
24 | /// f_long_name::Apples [`Bananas`]:
| ^^^^^^^ no item named `Bananas` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: `doctest` (lib doc) generated 3 warnings
Metadata
Metadata
Assignees
Labels
a-commentsonly-with-optionrequires a non-default option value to reproducerequires a non-default option value to reproduce