Skip to content

Commit 9a29e76

Browse files
committed
fix: clippy manual checked ops in progress output
1 parent 44a0254 commit 9a29e76

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

neve-cli/src/output.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,11 @@ impl ProgressBar {
242242
/// Render the progress bar.
243243
/// 渲染进度条。
244244
fn render(&self) {
245-
let percent = if self.total > 0 {
246-
(self.current * 100) / self.total
247-
} else {
248-
0
249-
};
245+
let percent = self
246+
.current
247+
.saturating_mul(100)
248+
.checked_div(self.total)
249+
.unwrap_or(0);
250250
let filled = (self.current * self.width) / self.total.max(1);
251251
let empty = self.width - filled;
252252

0 commit comments

Comments
 (0)