app: compute the download percentage with checked_div
The current clippy flags the `if total > 0` guard around the division as `manual_checked_ops`, and `-D warnings` turns that into a failed build, so nothing else in the app could be checked. `checked_div` says the same thing without the lint.
This commit is contained in:
1 parent
70e896b3cb
commit
9f6a047867
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -695,7 +695,7 @@ impl App {
|
||||
while let Ok(event) = rx.try_recv() {
|
||||
match event {
|
||||
export::FetchEvent::Bytes { done, total } => {
|
||||
let pct = if total > 0 { done * 100 / total } else { 0 };
|
||||
let pct = (done * 100).checked_div(total).unwrap_or(0);
|
||||
if self.ffmpeg_pct != Some(pct) {
|
||||
self.ffmpeg_pct = Some(pct);
|
||||
if self.ffmpeg_banner_showing() {
|
||||
|
||||
Reference in new issue
Block a user