-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Lint suggestion: undeclared_feature #5660
Comments
I would ideally like to submit a PR for this issue. I'm working on it right now, but it's taking some time and I'm not too sure how to go about it, since I need to capture the If someone here has a good idea on how I should go about doing that, please let me know. I've read the CONTRIBUTING.md and adding_lints.md, but I still have A LOT to learn ^^' |
You can look at this PR, which implements pretty much, what you're asking for: #5643 Sadly, it is not clear, how to proceed with pre-expansion lints (which means, before code get's removed due to features). |
Duplicate of #1614 |
Thanks for wanting to contribute though! I just don't want to let your work go to waste. If you want to get familiar with hacking on Clippy, you can look at the good first issues or if you want to add a new lint, you can look at the |
Yup, all good! I had try to look up in the issues but didn't find what I was looking for. In the meantime, I'm going to write a small program that does just that :) Thanks again! |
Hi,
This issue suggests a new lint:
undeclared_feature
. I tried following the guidelines, but feel free to change the name obviously.Take a fresh
Cargo.toml
file and add time as an optional dependency. Now write this code:You can then run:
and
$ cargo run --features time foo
I believe this is bad practice because this code effectively has a "hidden" feature, which should probably be documented and exposed via the Cargo.toml file. What do you think? Is this good / bad practice, and would a clippy lint be appropriate?
The text was updated successfully, but these errors were encountered: