Skip to content

impls should not inhibit the unused_item lint #47851

Closed
@nagisa

Description

@nagisa
#![crate_type="lib"]

enum Foo {
}

impl Clone for Foo {
    fn clone(&self) -> Foo { loop {} }
}

This code emits no warnings because impl Clone for Foo is considered a "use" of the enum, however, implementation for this enum cannot possibly be used either, as the enum is private and is unused. This is more notable for derived implementations, which also inhibit this lint.

The inherent implementations behave as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-trait-systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions