Skip to content

Commit

Permalink
Auto merge of #7426 - ebobrow:doc-markdown-fp, r=llogiq
Browse files Browse the repository at this point in the history
fix doc_markdown false positive

fixes #7421

changelog: don't lint unbalanced tick marks in code blocks
  • Loading branch information
bors committed Jul 3, 2021
2 parents 8420999 + e9a5694 commit c195db7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
FootnoteReference(text) | Text(text) => {
let (begin, span) = get_current_span(spans, range.start);
paragraph_span = paragraph_span.with_hi(span.hi());
ticks_unbalanced |= text.contains('`');
ticks_unbalanced |= text.contains('`') && !in_code;
if Some(&text) == in_link.as_ref() || ticks_unbalanced {
// Probably a link of the form `<http://example.com>`
// Which are represented as a link to "http://example.com" with
Expand Down
7 changes: 7 additions & 0 deletions tests/ui/doc/unbalanced_ticks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,10 @@ fn in_code_block() {}
/// - This `item has unbalanced tick marks
/// - This item needs backticks_here
fn other_markdown() {}

#[rustfmt::skip]
/// - ```rust
/// /// `lol`
/// pub struct Struct;
/// ```
fn iss_7421() {}

0 comments on commit c195db7

Please sign in to comment.