Skip to content

cargo (publish) should complain about unused source files #3754

Open
@oli-obk

Description

Originally proposed in rust-lang/rust#28711, attempted as a clippy lint in https://github.com/Manishearth/rust-clippy/pull/544. The clippy lint is not really feasible, since it requires knowledge about all other files in the project (main.rs and lib.rs don't know about each other, since they are of different rustc invocations).

Cargo could invoke rustc with --emit dep-info and compile a list of all files mentioned in the resulting .d file. Then, once all required files are collected, it could check that list against the .rs files in the src (and test?) folders and notify the user of any extra files that aren't used in any compilation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-publishS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions