2021-07-01 16:17:38 +00:00
|
|
|
//! This file tests for the `DOC_MARKDOWN` lint, specifically cases
|
|
|
|
//! where ticks are unbalanced (see issue #6753).
|
2023-08-24 19:32:12 +00:00
|
|
|
//@no-rustfix
|
2021-07-01 16:17:38 +00:00
|
|
|
#![allow(dead_code)]
|
|
|
|
#![warn(clippy::doc_markdown)]
|
|
|
|
|
|
|
|
/// This is a doc comment with `unbalanced_tick marks and several words that
|
2023-08-24 19:32:12 +00:00
|
|
|
//~^ ERROR: backticks are unbalanced
|
2021-07-01 16:17:38 +00:00
|
|
|
/// should be `encompassed_by` tick marks because they `contain_underscores`.
|
|
|
|
/// Because of the initial `unbalanced_tick` pair, the error message is
|
|
|
|
/// very `confusing_and_misleading`.
|
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
/// This paragraph has `unbalanced_tick marks and should stop_linting.
|
2023-08-24 19:32:12 +00:00
|
|
|
//~^ ERROR: backticks are unbalanced
|
2021-07-01 16:17:38 +00:00
|
|
|
///
|
|
|
|
/// This paragraph is fine and should_be linted normally.
|
2023-08-24 19:32:12 +00:00
|
|
|
//~^ ERROR: item in documentation is missing backticks
|
2021-07-01 16:17:38 +00:00
|
|
|
///
|
|
|
|
/// Double unbalanced backtick from ``here to here` should lint.
|
2023-08-24 19:32:12 +00:00
|
|
|
//~^ ERROR: backticks are unbalanced
|
2021-07-01 16:17:38 +00:00
|
|
|
///
|
|
|
|
/// Double balanced back ticks ``start end`` is fine.
|
|
|
|
fn multiple_paragraphs() {}
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
/// // Unbalanced tick mark in code block shouldn't warn:
|
|
|
|
/// `
|
|
|
|
/// ```
|
|
|
|
fn in_code_block() {}
|
|
|
|
|
|
|
|
/// # `Fine`
|
|
|
|
///
|
|
|
|
/// ## not_fine
|
2023-08-24 19:32:12 +00:00
|
|
|
//~^ ERROR: item in documentation is missing backticks
|
2021-07-01 16:17:38 +00:00
|
|
|
///
|
|
|
|
/// ### `unbalanced
|
2023-08-24 19:32:12 +00:00
|
|
|
//~^ ERROR: backticks are unbalanced
|
2021-07-01 16:17:38 +00:00
|
|
|
///
|
|
|
|
/// - This `item has unbalanced tick marks
|
2023-08-24 19:32:12 +00:00
|
|
|
//~^ ERROR: backticks are unbalanced
|
2021-07-01 16:17:38 +00:00
|
|
|
/// - This item needs backticks_here
|
2023-08-24 19:32:12 +00:00
|
|
|
//~^ ERROR: item in documentation is missing backticks
|
2021-07-01 16:17:38 +00:00
|
|
|
fn other_markdown() {}
|
2021-07-15 08:44:10 +00:00
|
|
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
/// - ```rust
|
|
|
|
/// /// `lol`
|
|
|
|
/// pub struct Struct;
|
|
|
|
/// ```
|
2023-09-08 22:39:20 +00:00
|
|
|
fn issue_7421() {}
|