Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cargo clippy --fix doesn't remove dead code #8713

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
jrmuizel opened this issue Apr 16, 2022 · 3 comments
Closed

cargo clippy --fix doesn't remove dead code #8713

jrmuizel opened this issue Apr 16, 2022 · 3 comments

Comments

@jrmuizel
Copy link

Description

It would be nice if cargo clippy --fix could remove the code that it complains about being dead.

Version

rustc 1.59.0 (9d1b2106e 2022-02-23)

Additional Labels

No response

@xFrednet
Copy link
Member

Hey, could you provide an example for this? The normal dead_code comes to mind, which is implemented in rustc. 🙃

@Oliboy50
Copy link

cargo fix should already remove the dead code, no?

@xFrednet
Copy link
Member

xFrednet commented May 2, 2023

The effect of cargo fix is defined by the applicability of the suggestion. I believe that dead_code doesn't actually suggest removing the code. It's mostly a lint to notify the user, in most cases users want to keep the original code. :)

If you really believe this would be a good addition, you should raise this issue in the rust-lang/rust repo. Though, I think the current behavior is intentional and good.

@Alexendoo Alexendoo closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 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