Skip to content

(false positive) doc_markdown should disregard escaped underscores #2581

Closed
rust-lang/rust
#115689
@lorepozo

Description

@lorepozo

If a docstring has an escaped underscore (\_), then clippy should treat that escaped underscore as any other (insignificant) character.

// lib.rs
//! Suppose a web LaTeX viewer is loaded.
//! (Note that backslashes are escaped for LaTeX.)
//!
//! \\[
//!     \\prod\_{x\\in X} p\_x
//! \\]

results in

warning: you should put `prod_{x\in` between ticks in the documentation
 --> src/lib.rs:5:10
  |
5 | //!     \\prod\_{x\\in X} p\_x
  |          ^^^^^^^^^^
  |
  = note: #[warn(doc_markdown)] on by default
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.190/index.html#doc_markdown

warning: you should put `p_x` between ticks in the documentation
 --> src/lib.rs:5:24
  |
5 | //!     \\prod\_{x\\in X} p\_x
  |                        ^^^
  |
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.190/index.html#doc_markdown

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingS-blockedStatus: marked as blocked ❌ on something else such as an RFC or other implementation work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions