Open njelich opened 7 months ago
@bnjbvr Pending review
Hi, as I'm working on my spare time on this project, I might not be very reactive for reviews and all of that.
That being said: how does this work? How can you guess the feature's name? (are you assuming the feature's named after the dependency?) Not sure how prevalent that usage is, so unclear whether we should do that automatically...
@bnjbvr I added a test case so you can see what it does. You can also add more autofix tests using the same setup.
In short, for a Cargo.toml with the unused log
dependency:
[dependencies]
log = "0.4.14"
[features]
default = ["std"]
std = ["log/std", "other"]
other = []
It sees the log
dependency is unused, and that the std
feature on the log
dependency is used with log/std
. When removing log
, it also removes the log/std
feature.
[dependencies]
[features]
default = ["std"]
std = [ "other"]
other = []
@bnjbvr Have you had a chance to take a look at this?
Getting back to this: any idea why the CI doesn't even show up? There's no job and no way for me to approve the run or not 🤔
Will check later today
When removing dependencies using the
--fix
flag, the features for those dependencies are not removed. This adds support for that.I tested it manually, but tests should probably be written to make sure it works generally. From what I can see there are currently no tests for the
--fix
functionality anyway.