Skip to content

needless_doctest_main triggers inside of multiline strings #5879

@udoprog

Description

@udoprog

The lint triggers for fn main()'s inside of multiline strings, like these:

/// ```
/// let string = r#"
/// fn main() {
///     // things
/// }
/// "#;
/// ```
fn my_documented_function() {
}

With:

warning: needless `fn main` in doctest
  --> crates\rune\src\ast\decl_file.rs:40:4
   |
40 | /// let string = r#"
   |    ^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(clippy::needless_doctest_main)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions