-
Notifications
You must be signed in to change notification settings - Fork 892
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
Cleanup download-related code in the rustup_dist crate #1131
Conversation
The actual code for handling downloads for rustup-dist is in `dist`, which in turn hands off to `rustup-utils` and `download` (the crate). Hopefully this clean-up makes it a little easier to figure out what's going on with downloads for future work.
The idea here is to reduce the API surface of `dist`, while consolidating download-related code into a single place. Was also able to remove a number of pointless pass-arounds of the `notification_handler` attached to DownloadCfg (haven't caught them all yet).
target_file.with_file_name( | ||
target_file.file_name().map(|s| { | ||
s.to_str().unwrap_or("_")}) | ||
.unwrap_or("_") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I know you didn't add this, but falling back to underscore seems like a bad idea, and the filename is supposed to be the hash anyway, so this should be an expect
instead.
This LGTM, thanks! The underscore thing I commented on should probably be fixed separately. @bors r+ |
📌 Commit 61f641a has been approved by |
Cleanup download-related code in the rustup_dist crate This PR is probably easiest to read if you do it commit-wise: the first commit just removes the old, unused `download` module from rustup_dist. The second commit pulls `DownloadCfg` (and friends) out into a _new_ `download` module. The only other change in there is that I've tried to kill some of the instances where the `notify_handler` gets needlessly passed around by moving functions to be methods on `DownloadCfg` + using the field it's already got. I suspect the only reason these weren't done before is that it was difficult to reason about the code, so hopefully this is an improvement. There aren't any (intentional) functional changes in this, so I haven't made any changes to the tests (aside from those required to get it to compile). No rush to get this merged for the same reason.
☀️ Test successful - status-appveyor, status-travis |
This PR is probably easiest to read if you do it commit-wise: the first commit just removes the old, unused
download
module from rustup_dist. The second commit pullsDownloadCfg
(and friends) out into a newdownload
module.The only other change in there is that I've tried to kill some of the instances where the
notify_handler
gets needlessly passed around by moving functions to be methods onDownloadCfg
+ using the field it's already got. I suspect the only reason these weren't done before is that it was difficult to reason about the code, so hopefully this is an improvement.There aren't any (intentional) functional changes in this, so I haven't made any changes to the tests (aside from those required to get it to compile). No rush to get this merged for the same reason.