#![allow(clippy::needless_doctest_main)] per doctest
⚓ Rust 📅 2025-11-22 👤 surdeus 👁️ 12#![allow(clippy::needless_doctest_main)] or #[allow(clippy::needless_doctest_main)] don't have effect when in the doctest itself. But #![allow(clippy::needless_doctest_main)] does apply when in src/lib.rs - which is strange, because (I've thought that) doctests are build in a separate crate (and they don't have access to non-public items).
Is that by design, or a likely error? I wish to apply ``#[allow(clippy::needless_doctest_main)]` granularly only where needed (rather than wild allow).
cargo +stable clippy
...
warning: needless `fn main` in doctest
--> src/linted_with_tests.rs:235:5
|
235 | /// #![allow(clippy::needless_doctest_main)]
| _____^
236 | | /// ::prudent::load!(any: "linted.rs");
237 | | /// use self::prudent::*;
238 | | /// #[allow(clippy::needless_doctest_main)]
... |
274 | | /// }
275 | | /// }
| |_____^
2 posts - 2 participants
🏷️ Rust_feed