Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc_markdown lint triggers erroneously wihtin links #5306

Closed
stouset opened this issue Mar 12, 2020 · 3 comments
Closed

doc_markdown lint triggers erroneously wihtin links #5306

stouset opened this issue Mar 12, 2020 · 3 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@stouset
Copy link

stouset commented Mar 12, 2020

$ cargo clippy -V
clippy 0.0.212 (329923ed 2020-03-04)

When using Markdown to link to methods within the generated documentation, this lint triggers erroneously. For instance:

/// Call [`new`][Foo::new] to instantiate this struct.
struct Foo {
}

In this made-up example, the target of the link is Foo::new per intra-rustdoc links. Adding backticks around it would break the intra-doc linking.

@flip1995 flip1995 added the C-bug Category: Clippy is not doing the correct thing label Mar 12, 2020
@jpospychala
Copy link
Contributor

If I read intra-rustdoc links correctly, reference link notation ([label][link]) requires a reference definition somewhere else in the document, like:

/// Call [`new`][fnew] to instantiate this struct.
///
/// [fnew]: Foo::new
struct Foo {
}

Then link doesn't trigger doc_markdown lint.

Otherwise a proper link format is inline link ([label](link)):

/// Call [`new`](Foo::new) to instantiate this struct.
struct Foo {
}

@stouset
Copy link
Author

stouset commented Apr 3, 2020

The reference definitions are unnecessary for unambiguous names like Foo::new. They are created automatically. Try it!

@stouset
Copy link
Author

stouset commented Apr 3, 2020

Oh no... I just reread the PR and it turns out for over a year I've been doing this wrong. Interestingly it still works (or at least it did back when I first used it).

@stouset stouset closed this as completed Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

3 participants