holmgr / cargo-sweep

A cargo subcommand for cleaning up unused build files generated by Cargo
MIT License
694 stars 31 forks source link

could cargo-sweep work without rustup? #26

Closed bbigras closed 4 years ago

bbigras commented 4 years ago

I don't use rustup and I was wondering if this tool could still work without it.

Eh2406 commented 4 years ago

The "installed" and "toolchains" modes do rely on rustup at the moment. The others do not. I would love to see it have graceful fallback to using rustc directly. A PR is wellcome!

Skimming the code the only places we rely on rustup are:

https://github.com/holmgr/cargo-sweep/blob/04c03595b04266df97292cf2ebd46c9a56148d6f/src/fingerprint.rs#L301-L303 Where we use it to determine the available rustc toolchains. This could return a sentinel value if rustup is not available. and: https://github.com/holmgr/cargo-sweep/blob/04c03595b04266df97292cf2ebd46c9a56148d6f/src/fingerprint.rs#L285-L286 Where we use the +toolchain syntax that rustup adds. This function could check for the sentinel value and not use the +toolchain if it is not available.

@holmgr, can we add a help-wanted and feature-request or similar tags? I would but I don't have perms on this repo.

holmgr commented 4 years ago

Yes, that seems like a great idea @Eh2406, will give some more permissions :)