Skip to content
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

Dead code doesn't trigger dead_code lint #135957

Closed
GuillaumeGomez opened this issue Jan 23, 2025 · 2 comments
Closed

Dead code doesn't trigger dead_code lint #135957

GuillaumeGomez opened this issue Jan 23, 2025 · 2 comments

Comments

@GuillaumeGomez
Copy link
Member

In askama-rs/askama#311, we realized that an unused (private) method was not triggering the dead_code lint. The method is calling itself, but that's the only call for this method and I wonder if it's the problem here (although I cannot seem to replicate the bug in smaller code...).

The code not triggering the lint can be found here.

@GuillaumeGomez GuillaumeGomez added the C-bug Category: This is a bug. label Jan 23, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 23, 2025
@cyrgani
Copy link
Contributor

cyrgani commented Jan 23, 2025

Isn't that just because its identifier starts with _ and those are intentionally ignored by dead_code?
https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#explanation-18

@GuillaumeGomez
Copy link
Member Author

I'm ashamed for not having thought to that... Thanks!

@fmease fmease removed C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants