Skip to content

False warning with #[warn(unused_imports)] for std::ops::Deref #51556

Closed
@raphaelcohn

Description

@raphaelcohn

The lint #[warn(unused_imports)] produces a false warning of "warning: unused import: ::std::ops::Deref", which is incorrect; following the warning and removing the import creates code that does not compile.

In my lib.rs I have use ::std::ops::Deref.

In submodules, which use use super::* imports, I have some code that explicitly calls xxx.deref(). Following the warning and removing the import from lib.rs causes code to break. (As an aside, this code explicitly calls deref() because trying to auto-deref confuses the compiler in this code).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions