-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Teach make-tidy to detect unused *.rs files #28711
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
I second this motion. A while back I forgot to add a |
cc #12565 |
It'd be cool if this was made generic enough such that any project could utilize it |
I've started working on a compiler plugin that does that. I would be happy to add this to the lints shipped with Rust. It works as follows. It collects all Rust source files in the source directory and all subdirectories and also generates a set of all files used in the crate using the There is one catch however. Because it uses the |
…st, r=alexcrichton While working on rust-lang#28711 I found out that * src/libcoretest/clone.rs * src/libcoretest/fmt/float.rs * src/libcoretest/intrinsics.rs are not used. I am not sure if removing them is the right way to go. If it makes sense to keep (and fix and enable) them, I would be happy to update the PR.
…richton While working on #28711 I found out that * src/libcoretest/clone.rs * src/libcoretest/fmt/float.rs * src/libcoretest/intrinsics.rs are not used. I am not sure if removing them is the right way to go. If it makes sense to keep (and fix and enable) them, I would be happy to update the PR.
Triage: not aware of any changes here. |
One possible way to implement this (including as a third-party tool) is to parse the |
A small hack to do this with shell: rg --no-filename '^[^/].*\.rs:$' target/debug/deps/*.d | sed 's/:$//' | sort -u | diff - <(fd '\.rs$' | sort -u) |
As an example, the file https://github.com/rust-lang/rust/blob/master/src/librustc_front/attr.rs is currently dead and can be removed, but before realizing it I spent several minutes trying to understand what's wrong with my text editor and why can't it find the definition of
unlower_attribute
.The text was updated successfully, but these errors were encountered: