Skip to content

needless_doctest_main yields false positive with proc macros #4698

@Rantanen

Description

@Rantanen

Clippy version: 0.0.212 (e979eb4 2019-10-17)

Clippy warns that the fn main() {} is not needed in the following doctest:

https://github.com/Rantanen/intercom/blob/45837a4d77c340c9cb8cf45142843198a80a82b6/intercom/src/lib.rs#L12-L36

However removing that will end up with doctest wrapping the whole thing in a function, which results in the com_library!(Calculator); becoming a statement - something that is not allowed for (at least that) proc macro.

I feel like this is enough of a niche case that there's no real need to fix it. A note could be added to the Known problems section of the lint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions