Skip to content

Commit e2fc76c

Browse files
committed
[cpu] Suppress refutability warning specific to WASM builds.
f64::value_from(usize) seems to be irrefutable (and thus generates a warning when used with `if let`) in a WASM build, but not in other builds.
1 parent 46f9b17 commit e2fc76c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cpu/src/io/dev_petr.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@ fn compute_throughput(
307307
if let Some(connected_at) = connect_time {
308308
if let Some(elapsed) = now.checked_sub(connected_at) {
309309
let elapsed = elapsed.as_secs_f64();
310+
311+
// It seems that in a WASM build, f64::value_from(usize)
312+
// is irrefutable. But clippy doesn't warn about it in
313+
// non-WASM builds because it's not always irrefutable.
314+
#[allow(irrefutable_let_patterns)]
310315
if let Ok(n) = f64::value_from(pos) {
311316
let throughput = n / elapsed;
312317
return Some(Throughput {

0 commit comments

Comments
 (0)