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

False positive in doc_markdown unbalanced backticks if code block in list contains backtick #7421

Closed
dtolnay opened this issue Jul 3, 2021 · 0 comments · Fixed by #7426
Closed
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@dtolnay
Copy link
Member

dtolnay commented Jul 3, 2021

//! - ```rust
//!   /// `lol`
//!   pub struct Struct;
//!   ```

fn main() {}
$ cargo clippy --tests -- -Dclippy::pedantic
error: backticks are unbalanced
 --> src/main.rs:1:1
  |
1 | / //! - ```rust
2 | | //!   /// `lol`
  | |_______________^
  |
  = note: `-D clippy::doc-markdown` implied by `-D clippy::pedantic`
  = help: a backtick may be missing a pair
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown

This seems like a false positive. There are no unbalanced backticks in the above.

screenshot of rendered documentation

Mentioning @ebobrow @xFrednet @flip1995 who touched this lint in #7357.


Meta

  • cargo clippy -V: clippy 0.1.55 (798baeb 2021-07-02)
  • rustc -Vv:
    rustc 1.55.0-nightly (798baebde 2021-07-02)
    binary: rustc
    commit-hash: 798baebde1fe77e5a660490ec64e727a5d79970d
    commit-date: 2021-07-02
    host: x86_64-unknown-linux-gnu
    release: 1.55.0-nightly
    LLVM version: 12.0.1
    
@dtolnay dtolnay 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 Jul 3, 2021
dtolnay added a commit to dtolnay/thiserror that referenced this issue Jul 3, 2021
Clippy bug: rust-lang/rust-clippy#7421

    error: backticks are unbalanced
       --> src/lib.rs:128:1
        |
    128 | / //!   Any error type that implements `std::error::Error` or dereferences to `dyn
    129 | | //!   std::error::Error` will work as a source.
    130 | | //!
    131 | | //!   ```rust
    132 | | //!   # use std::fmt::{self, Display};
        | |______________________________________^
        |
        = note: `-D clippy::doc-markdown` implied by `-D clippy::pedantic`
        = help: a backtick may be missing a pair
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
@bors bors closed this as completed in c195db7 Jul 3, 2021
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 I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant