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

Improve download progress #355

Merged
merged 1 commit into from
Apr 25, 2016
Merged

Improve download progress #355

merged 1 commit into from
Apr 25, 2016

Conversation

nodakai
Copy link
Contributor

@nodakai nodakai commented Apr 24, 2016

No description provided.

Signed-off-by: NODA, Kai <[email protected]>
let sum = self.downloaded_last_few_secs
.iter()
.fold(0usize, |a, &v| a v);
.fold(0., |a, &v| a v as f64);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the point of making this a float? this is simple addition of integers, there's no rounding here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this is just a matter of taste. I just wanted sum to be a float and I tend to apply int-to-float casting as early as possible when I know the end result is a float.

@brson
Copy link
Contributor

brson commented Apr 25, 2016

Thanks for the improvements @nodakai, and for explaining the float math.

@brson brson merged commit d7aad4c into rust-lang:master Apr 25, 2016
@nodakai
Copy link
Contributor Author

nodakai commented Apr 26, 2016

@brson Sorry I need fix the condition to display "unknown". But haven't got the time... I'll prepare another patch.

@nodakai nodakai deleted the progress branch April 27, 2016 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants