Skip to content

doc_link_with_quotes false postive for code inside code block #8961

@dtolnay

Description

@dtolnay

Summary

The doc_link_with_quotes lint is documented as:

Detects the syntax ['foo'] in documentation comments (notice quotes instead of backticks) outside of code blocks

However it is incorrectly triggering on code inside of code blocks.

Lint Name

doc_link_with_quotes

Reproducer

/// This is a code block:
///
/// ```
/// let _ = vec!['w', 'a', 't'];
/// ```
fn main() {}
error: possible intra-doc link using quotes instead of backticks
 --> src/main.rs:4:1
  |
4 | /// let _ = vec!['w', 'a', 't'];
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `-D clippy::doc-link-with-quotes` implied by `-D clippy::pedantic`
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes

It is indeed a code block though.

Screenshot from 2022-06-07 00-27-18

Mentioning @cameron1024 since this lint was recently added in #8385.

Version

rustc 1.63.0-nightly (50b00252a 2022-06-06)
binary: rustc
commit-hash: 50b00252aeb77b10db04d65dc9e12ce758def4b5
commit-date: 2022-06-06
host: x86_64-unknown-linux-gnu
release: 1.63.0-nightly
LLVM version: 14.0.5

Additional Labels

No response

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions