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_nested_refdefs: new lint for suspicious list syntax #13707

Merged
merged 2 commits into from
Dec 2, 2024

Conversation

notriddle
Copy link
Contributor

@notriddle notriddle commented Nov 19, 2024

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.

- [`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.
  • 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

@rustbot
Copy link
Collaborator

rustbot commented Nov 19, 2024

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 19, 2024
@notriddle notriddle force-pushed the notriddle/link-ref-in-list branch 2 times, most recently from 8af734f to eb228e7 Compare November 19, 2024 20:00
@bors
Copy link
Contributor

bors commented Nov 21, 2024

☔ The latest upstream changes (presumably 8298da7) made this pull request unmergeable. Please resolve the merge conflicts.

@Jarcho
Copy link
Contributor

Jarcho commented Nov 21, 2024

Is Tag::DefinitionList used for something other than reference definitions? You should be able to use that rather than trying to parse them.

@Jarcho
Copy link
Contributor

Jarcho commented Nov 22, 2024

@notriddle
Copy link
Contributor Author

notriddle commented Nov 22, 2024

Tag::DefinitionList is an unrelated syntax extension that rustdoc doesn't even enable.

@notriddle notriddle force-pushed the notriddle/link-ref-in-list branch from eb228e7 to fbd39d3 Compare November 24, 2024 00:10
Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of little things, but otherwise looks good.

Could you also add this check to block quotes as well since they have the same issue. I would just put them under a single lint named either doc_nested_reference_definitions or doc_nested_refdefs (I don't have a preference on whether to use the shorthand).

FCP has received no objections so this should be good to go.

clippy_lints/src/doc/mod.rs Outdated Show resolved Hide resolved
clippy_lints/src/doc/mod.rs Outdated Show resolved Hide resolved
@Jarcho
Copy link
Contributor

Jarcho commented Nov 27, 2024

Tag::DefinitionList is an unrelated syntax extension that rustdoc doesn't even enable.

That's rather unfortunate that these don't show up in the parser at all.

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 or quote.

```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.
```
@notriddle notriddle force-pushed the notriddle/link-ref-in-list branch from fbd39d3 to 61c1cc1 Compare November 27, 2024 20:48
@notriddle notriddle force-pushed the notriddle/link-ref-in-list branch from 61c1cc1 to 8dd45f1 Compare November 27, 2024 20:51
@notriddle
Copy link
Contributor Author

Okay, I've made both changes.

@Jarcho Jarcho changed the title doc_refdef_list_item: new lint for suspicious list syntax doc_nested_refdefs: new lint for suspicious list syntax Dec 2, 2024
Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@Jarcho Jarcho added this pull request to the merge queue Dec 2, 2024
Merged via the queue into rust-lang:master with commit 66b15ad Dec 2, 2024
9 checks passed
@notriddle notriddle deleted the notriddle/link-ref-in-list branch December 2, 2024 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants