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

Added remaining stats to the garbage command. #113

Merged
merged 2 commits into from
Aug 9, 2018

Conversation

data-pup
Copy link
Member

@data-pup data-pup commented Aug 9, 2018

Adding stats calculation to the garbage sub-command's "... and X more" row. Also add's the remaining/total rows to the JSON output to match the behavior of other sub-commands.

Note: This doesn't clean things up to remove duplicated logic from the Emit trait the same way some of the other PR's have, but that can be done soon 😄

@fitzgen
Copy link
Member

fitzgen commented Aug 9, 2018

Note: This doesn't clean things up to remove duplicated logic from the Emit trait the same way some of the other PR's have, but that can be done soon smile

👍 💖

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Thanks as always @data-pup :)

r=me with nitpick below addressed!

.map(|id| &items[*id])
.fold((0, 0), |(size, cnt), item| (size + item.size(), cnt + 1))
{
(size, cnt) if cnt > 0 => {
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: I think this would be a bit more readable as

let (size, cnt) = self
    .items
    .iter()
    .skip(self.limit)
    .map(|id| &items[*id])
    .fold((0, 0), |(size, cnt), item| (size + item.size(), cnt + 1));
if cnt > 0 {
    ...
}

@fitzgen fitzgen merged commit 46b0151 into rustwasm:master Aug 9, 2018
@data-pup data-pup deleted the add-garbage-rem-stats branch August 20, 2018 16:07
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.

2 participants