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

pb: better progress-bar padding #85

Merged
merged 1 commit into from
Sep 21, 2019
Merged

pb: better progress-bar padding #85

merged 1 commit into from
Sep 21, 2019

Conversation

a8m
Copy link
Owner

@a8m a8m commented Sep 14, 2019

Closing #58

Other formatting changes caused by cargo fmt.

@a8m
Copy link
Owner Author

a8m commented Sep 14, 2019

cc @winstonewert

src/pb.rs Outdated
.split("")
.map(|x| x.to_owned())
.filter(|x| x != "")
.collect();
Copy link
Contributor

Choose a reason for hiding this comment

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

Its not really part of this commit, but this bit of code seems quite odd to me.

src/pb.rs Outdated
@@ -347,18 +351,21 @@ impl<T: Write> ProgressBar<T> {
}
}
}
if !suffix.starts_with(" ") {
suffix = format!(" {}", suffix);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest that instead of this, you remove the space from line 334, and then either unconditionally add the space at line 395 or when you create the string at line 326.

@a8m a8m force-pushed the fix/pad-suffix branch 2 times, most recently from 1e310a7 to 68e6b11 Compare September 15, 2019 08:30
src/pb.rs Outdated
parts.push(format!("{:.0}m", left / 60.));
};
}
if parts.len() > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it is recommended to use is_empty() instead of len() > 0. However, I think you could just drop the condition altogether since joining an empty vec will produce an empty string anyways.

Copy link
Contributor

@winstonewert winstonewert left a comment

Choose a reason for hiding this comment

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

I've run out of things to complain about :P

@a8m a8m merged commit 7714f4e into master Sep 21, 2019
@a8m a8m deleted the fix/pad-suffix branch September 21, 2019 11:26
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