Skip to content

unused_crate_dependencies false positives for dev-dependencies added for Doctests #101334

Open
@laralove143

Description

@laralove143

I tried this code:

[dev-dependencies]
once_cell = "1.14"
/// ```rust
/// use once_cell::sync::Lazy;
/// ```
fn foo() {}

I expected to see this happen: No warning since once_cell is used in the Doctest

Instead, this happened: The warning is still emitted

Meta

rustc --version --verbose:

rustc 1.62.1 (e092d0b6b 2022-07-16)
binary: rustc
commit-hash: e092d0b6b43f2de967af0887873151bb1c0b18d3
commit-date: 2022-07-16
host: aarch64-apple-darwin
release: 1.62.1
LLVM version: 14.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cratesArea: Crates and their interactions (like crate loading)A-doctestsArea: Documentation tests, run by rustdocA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions