-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveL-pedanticLint: Belongs in the pedantic lint groupLint: Belongs in the pedantic lint groupP-lowPriority: LowPriority: Low
Description
Summary
Some crates (e.g. clap) interpret doc comments literally and not as markdown, in which case JSON examples may be helpful for e.g. demonstration purposes.
Idea for a fix: Check if the intended-to-be doclink can even be one, as would not be the case with e.g. containing spaces.
(more hacky possibility would be to parse JSON and see if it's 1. an array 2. consisting of strings 3. with more than 1 item)
Lint Name
doc_link_with_quotes
Reproducer
I tried this code:
#![deny(clippy::doc_link_with_quotes)]
//! ["a", "b"]
I saw this happen:
error: possible intra-doc link using quotes instead of backticks
--> src/main.rs:2:6
|
2 | //! ["a", "b"]
| ^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes
note: the lint level is defined here
--> src/main.rs:1:9
|
1 | #![deny(clippy::doc_link_with_quotes)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I expected to see this happen:
(nothing, as ["a", "b"]
is evidently not intended to be a doclink)
Version
rustc 1.92.0-nightly (2300c2aef 2025-10-12)
binary: rustc
commit-hash: 2300c2aef7dbc2a7bbbeaa9894d07d459abd9bc6
commit-date: 2025-10-12
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.2
Additional Labels
@rustbot label +L-pedantic +P-low
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveL-pedanticLint: Belongs in the pedantic lint groupLint: Belongs in the pedantic lint groupP-lowPriority: LowPriority: Low