Skip to content

dead_code lint does not trigger for traits at all. #66543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
oli-cosmian opened this issue Nov 19, 2019 · 1 comment
Closed

dead_code lint does not trigger for traits at all. #66543

oli-cosmian opened this issue Nov 19, 2019 · 1 comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@oli-cosmian
Copy link

I'd expect some kind of warning for a crate defining but not exporting and not using a trait. While it would be great to also report traits that are implemented for types but whose implementation is never used, this may be significantly harder to detect, not sure.

trait Foo {
    fn foo(&self) {}
    fn bar(&self) {}
}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
    Finished dev [unoptimized + debuginfo] target(s) in 1.10s

@jonas-schievink jonas-schievink added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 19, 2019
@oskgo
Copy link
Contributor

oskgo commented Jul 4, 2024

Triage: This was fixed at some point. The playground example now gives a dead code warning as it should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants