-
Notifications
You must be signed in to change notification settings - Fork 13.3k
dead_code warnings for functions/types used in a unused function #39531
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
Comments
AFAIR its intentional. Neither of the See #29064 for similar case. |
@nagisa, |
Note that this is |
I agree that the But I think there is room for improvement: We could list the |
How would this interact with unused functions that call themselves/each other? |
@Storyyeller, |
I will keep this issue opened for several days to see whether someone suggests something. |
I also don't like E.g. compiling this code warns that Interestingly, the |
I'd like to make the case that this should be changed to be non-transitive. There are four major reasons this lint would appear in a codebase:
Walking through the workflow for resolving these will tell us what is preferable in each case. In case (1), the person reading the code will need to first identify if this is situation 1,2, or 3 before they know what to do. So they will need to identify the root of the problem. In case (2) they will want to delete all of the dead code. In case (3), the user will need to find the root issue. In this case the non-transitive error is preferred. Case (4) really tips the scales. Because the warning is just noise that the user will ignore. The worst fate that can befall a lint check is for it to generate so many warnings (legitimate or not) that the user feels overwhelmed and starts ignoring the warnings or turns off the check. If this happens not only does the dead code problem not get fixed, but other bugs possibly more serious ones, get overlooked also. Making the error non-transitive might be a little slower in some cases, but it is faster in others. |
|
I wrote on the Users forum explaining why I believe the current design is inferior in all use cases. tl;dr:
The only thing that could potentially make it useful would be if |
Or at least differentiate a function that is not used anywhere from only used in unused function chain in the warning. This will help user to find out the "root" unused function. |
I also find this annoying. How about at least |
Hi everybody.
Playground
Code:
Output:
I don't like it because it confuses what exactly isn't used.
The text was updated successfully, but these errors were encountered: