Skip to content
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

Warn when .rs files in examples/tests/benches are unused #4894

Closed
jonas-schievink opened this issue Jan 4, 2018 · 3 comments
Closed

Warn when .rs files in examples/tests/benches are unused #4894

jonas-schievink opened this issue Jan 4, 2018 · 3 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@jonas-schievink
Copy link
Contributor

By default, Cargo will compile all files inside examples/tests/benches. However, when at least one example, test or benchmark is specified in the Cargo.toml, all other files in the respective directory are ignored. It would be nice to emit a warning since such a directory layout is very unlikely to be intentional (multi-file targets are supposed to get their own subdirectory).

Related: #4013

(this could also be done for files in src/bin/*, but that configuration is used intentionally sometimes, for example by Cargo itself)

@alexcrichton alexcrichton added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jan 4, 2018
@MathieuDuponchelle
Copy link

Alternatively, other files could also not be ignored, I have a use case where I want to specify required-features for one target, but end up being forced to define all the other targets, which makes me sad, curious what the reason is for that behaviour?

@dwijnand
Copy link
Member

dwijnand commented Aug 5, 2018

Resolved with #5330, I'd say.

@jonas-schievink
Copy link
Contributor Author

Yep, looks like it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

4 participants