-
Notifications
You must be signed in to change notification settings - Fork 60
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
Conversation
src/pb.rs
Outdated
.split("") | ||
.map(|x| x.to_owned()) | ||
.filter(|x| x != "") | ||
.collect(); |
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.
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); | |||
} |
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.
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.
1e310a7
to
68e6b11
Compare
src/pb.rs
Outdated
parts.push(format!("{:.0}m", left / 60.)); | ||
}; | ||
} | ||
if parts.len() > 0 { |
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.
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.
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.
I've run out of things to complain about :P
Closing #58
Other formatting changes caused by
cargo fmt
.