forked from rust-lang/rust-clippy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc_nested_refdefs: new lint for suspicious list syntax (rust-lang#13707
) rust-lang/rust#133150 This is more likely to be intended as an intra-doc link than it is to be intended as a refdef. If a refdef is intended, it does not need to be nested within a list item. ```markdown - [`LONG_INTRA_DOC_LINK`]: this looks like an intra-doc link, but is actually a refdef. The first line will seem to disappear when rendered as HTML. ``` > - [`LONG_INTRA_DOC_LINK`]: this > looks like an intra-doc link, > but is actually a refdef. > The first line will seem to > disappear when rendered as HTML. changelog: [`doc_nested_refdefs`]: add suspicious lint for link def at start of list items and block quotes
- Loading branch information
Showing
9 changed files
with
812 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
// https://github.com/rust-lang/rust/issues/133150 | ||
#![warn(clippy::doc_nested_refdefs)] | ||
#[rustfmt::skip] | ||
/// > [link][]: def | ||
//~^ ERROR: link reference defined in quote | ||
/// | ||
/// > [link][]: def (title) | ||
//~^ ERROR: link reference defined in quote | ||
/// | ||
/// > [link][]: def "title" | ||
//~^ ERROR: link reference defined in quote | ||
/// | ||
/// > [link]: not def | ||
/// | ||
/// > [link][]: notdef | ||
/// | ||
/// > [link]\: notdef | ||
pub struct Empty; | ||
|
||
#[rustfmt::skip] | ||
/// > [link][]: def | ||
//~^ ERROR: link reference defined in quote | ||
/// > inner text | ||
/// | ||
/// > [link][]: def (title) | ||
//~^ ERROR: link reference defined in quote | ||
/// > inner text | ||
/// | ||
/// > [link][]: def "title" | ||
//~^ ERROR: link reference defined in quote | ||
/// > inner text | ||
/// | ||
/// > [link]: not def | ||
/// > inner text | ||
/// | ||
/// > [link][]: notdef | ||
/// > inner text | ||
/// | ||
/// > [link]\: notdef | ||
/// > inner text | ||
pub struct NotEmpty; | ||
|
||
#[rustfmt::skip] | ||
/// > [link][]: def | ||
//~^ ERROR: link reference defined in quote | ||
/// > | ||
/// > inner text | ||
/// | ||
/// > [link][]: def (title) | ||
//~^ ERROR: link reference defined in quote | ||
/// > | ||
/// > inner text | ||
/// | ||
/// > [link][]: def "title" | ||
//~^ ERROR: link reference defined in quote | ||
/// > | ||
/// > inner text | ||
/// | ||
/// > [link]: not def | ||
/// > | ||
/// > inner text | ||
/// | ||
/// > [link][]: notdef | ||
/// > | ||
/// > inner text | ||
/// | ||
/// > [link]\: notdef | ||
/// > | ||
/// > inner text | ||
pub struct NotEmptyLoose; | ||
|
||
#[rustfmt::skip] | ||
/// > first lines | ||
/// > [link]: def | ||
/// | ||
/// > first lines | ||
/// > [link]: def (title) | ||
/// | ||
/// > firs lines | ||
/// > [link]: def "title" | ||
/// | ||
/// > firs lines | ||
/// > [link]: not def | ||
/// | ||
/// > first lines | ||
/// > [link][]: notdef | ||
/// | ||
/// > first lines | ||
/// > [link]\: notdef | ||
pub struct NotAtStartTight; | ||
|
||
#[rustfmt::skip] | ||
/// > first lines | ||
/// > | ||
/// > [link]: def | ||
/// | ||
/// > first lines | ||
/// > | ||
/// > [link]: def (title) | ||
/// | ||
/// > firs lines | ||
/// > | ||
/// > [link]: def "title" | ||
/// | ||
/// > firs lines | ||
/// > | ||
/// > [link]: not def | ||
/// | ||
/// > first lines | ||
/// > | ||
/// > [link][]: notdef | ||
/// | ||
/// > first lines | ||
/// > | ||
/// > [link]\: notdef | ||
pub struct NotAtStartLoose; | ||
|
||
#[rustfmt::skip] | ||
/// > - [link][]: def | ||
//~^ ERROR: link reference defined in list item | ||
/// > | ||
/// > - [link][]: def (title) | ||
//~^ ERROR: link reference defined in list item | ||
/// > | ||
/// > - [link][]: def "title" | ||
//~^ ERROR: link reference defined in list item | ||
/// > | ||
/// > - [link]: not def | ||
/// > | ||
/// > - [link][]: notdef | ||
/// > | ||
/// > - [link]\: notdef | ||
pub struct ListNested; |
Oops, something went wrong.