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_link_with_quotes does not ignore code blocks #9321

Closed
lopopolo opened this issue Aug 11, 2022 · 1 comment
Closed

doc_link_with_quotes does not ignore code blocks #9321

lopopolo opened this issue Aug 11, 2022 · 1 comment
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@lopopolo
Copy link

lopopolo commented Aug 11, 2022

Summary

Triple backtick code blocks are not ignored by this lint.

Lint Name

doc_link_with_quotes

Reproducer

I tried this code:

//! ENV is a hash-like accessor for environment variables.
//!
//! This module implements the [`ENV`] singleton object from Ruby Core.
//!
//! In Artichoke, the environment variable store is modeled as a hash map of
//! byte vector keys and values, e.g. `HashMap<Vec<u8>, Vec<u8>>`. Backends are
//! expected to convert their internals to this representation in their public
//! APIs. For this reason, all APIs exposed by ENV backends in this crate are
//! fallible.
//!
//! You can use this object in your application by accessing it directly. As a
//! Core API, it is globally available:
//!
//! ```ruby
//! ENV['PATH']
//! ENV['PS1'] = 'artichoke> '
//! ```
//!
//! [`ENV`]: https://ruby-doc.org/core-3.1.2/ENV.html

fn main() {
    println!("Hello, world!");
}

I saw this happen:

$ cargo clippy -- -W clippy::all -W clippy::pedantic
    Checking clippy_doc_link v0.1.0 (/Users/lopopolo/dev/artichoke/clippy_doc_link)
warning: possible intra-doc link using quotes instead of backticks
  --> src/main.rs:15:1
   |
15 | //! ENV['PATH']
   | ^^^^^^^^^^^^^^^
   |
   = note: `-W clippy::doc-link-with-quotes` implied by `-W clippy::pedantic`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes

warning: possible intra-doc link using quotes instead of backticks
  --> src/main.rs:16:1
   |
16 | //! ENV['PS1'] = 'artichoke> '
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes

warning: `clippy_doc_link` (bin "clippy_doc_link") generated 2 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 0.43s

I expected to see this happen: These docs are inside a "triple backtick" code block with a ruby language tag. I expect this lint to ignore this text.

Version

rustc 1.63.0 (4b91a6ea7 2022-08-08)
binary: rustc
commit-hash: 4b91a6ea7258a947e59c6522cd5898e7c0a6a88f
commit-date: 2022-08-08
host: x86_64-apple-darwin
release: 1.63.0
LLVM version: 14.0.5

Additional Labels

No response

@lopopolo lopopolo added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Aug 11, 2022
@xFrednet xFrednet added the good-first-issue These issues are a good way to get started with Clippy label Aug 11, 2022
@jendrikw
Copy link
Contributor

Dupe of #8961.

lopopolo added a commit to artichoke/artichoke that referenced this issue Aug 12, 2022
@Alexendoo Alexendoo closed this as not planned Won't fix, can't repro, duplicate, stale Sep 25, 2022
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 good-first-issue These issues are a good way to get started with Clippy I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

No branches or pull requests

4 participants