We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 44a0254 commit 9a29e76Copy full SHA for 9a29e76
neve-cli/src/output.rs
@@ -242,11 +242,11 @@ impl ProgressBar {
242
/// Render the progress bar.
243
/// 渲染进度条。
244
fn render(&self) {
245
- let percent = if self.total > 0 {
246
- (self.current * 100) / self.total
247
- } else {
248
- 0
249
- };
+ let percent = self
+ .current
+ .saturating_mul(100)
+ .checked_div(self.total)
+ .unwrap_or(0);
250
let filled = (self.current * self.width) / self.total.max(1);
251
let empty = self.width - filled;
252
0 commit comments