Skip to content
New issue

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

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

Already on GitHub? # to your account

Notice unused code in a workspace #5828

Closed
stevenroose opened this issue Jul 21, 2020 · 1 comment
Closed

Notice unused code in a workspace #5828

stevenroose opened this issue Jul 21, 2020 · 1 comment
Labels
A-lint Area: New lints

Comments

@stevenroose
Copy link

What it does

A lot of projects have a workspace with multiple crates. This means that they will define most of their types as pub instead of pub(crate). However this means that all crates are libraries and thus cargo won't warn you for unused code within the crate.

So it would be useful if we'd have a way to find unused code within a workspace instead of just within a crate.

Categories (optional)

  • Kind: clippy::nursery

Drawbacks

Could point out unused code in some crates that are intended for usage outside the workspace.

@stevenroose stevenroose added the A-lint Area: New lints label Jul 21, 2020
@flip1995
Copy link
Member

This is impossible to do for Clippy, since it would require a global analysis.

In addition to that, Clippy (also cargo and rustc) can't know, if a pub function is unused, since there could be some other crate out there, not in the workspace, that uses this pub function.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

No branches or pull requests

2 participants