Skip to content

Commit 9bab06c

Browse files
Fix a few WASI lints (#8457)
I left one lint (a clippy deny) unfixed because it's a lot more involved, so I'll work on it in a different patch.
1 parent daafafa commit 9bab06c

5 files changed

Lines changed: 16 additions & 7 deletions

File tree

crates/vm/src/frame.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3046,6 +3046,7 @@ impl ExecutingFrame<'_> {
30463046
}
30473047
}
30483048

3049+
#[cfg_attr(not(feature = "threading"), allow(clippy::collapsible_if))]
30493050
if vm.eval_breaker_tripped() {
30503051
if let Err(exception) = vm.check_signals() {
30513052
#[cold]

crates/vm/src/gc_state.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use core::sync::atomic::{AtomicBool, AtomicU32, AtomicUsize, Ordering};
1111
use std::collections::HashSet;
1212

1313
fn elapsed_secs(
14-
#[cfg(target_arch = "wasm32")] _start: &(),
15-
#[cfg(not(target_arch = "wasm32"))] start: &std::time::Instant,
14+
#[cfg(target_arch = "wasm32")] _start: (),
15+
#[cfg(not(target_arch = "wasm32"))] start: std::time::Instant,
1616
) -> f64 {
1717
cfg_select! {
1818
target_arch = "wasm32" => 0.0,
@@ -528,7 +528,7 @@ impl GcState {
528528
self.generations[i].count.store(0, Ordering::SeqCst);
529529
}
530530

531-
let duration = elapsed_secs(&start_time);
531+
let duration = elapsed_secs(start_time);
532532

533533
self.generations[generation].update_stats(0, 0, 0, duration);
534534
return CollectResult {
@@ -704,7 +704,7 @@ impl GcState {
704704
self.generations[i].count.store(0, Ordering::SeqCst);
705705
}
706706

707-
let duration = elapsed_secs(&start_time);
707+
let duration = elapsed_secs(start_time);
708708

709709
self.generations[generation].update_stats(0, 0, candidates, duration);
710710
return CollectResult {
@@ -727,7 +727,7 @@ impl GcState {
727727
self.generations[i].count.store(0, Ordering::SeqCst);
728728
}
729729

730-
let duration = elapsed_secs(&start_time);
730+
let duration = elapsed_secs(start_time);
731731

732732
self.generations[generation].update_stats(0, 0, candidates, duration);
733733
return CollectResult {
@@ -953,7 +953,7 @@ impl GcState {
953953
self.generations[i].count.store(0, Ordering::SeqCst);
954954
}
955955

956-
let duration = elapsed_secs(&start_time);
956+
let duration = elapsed_secs(start_time);
957957

958958
self.generations[generation].update_stats(collected, 0, candidates, duration);
959959

crates/vm/src/stdlib/_signal.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ pub(crate) mod _signal {
429429
}
430430

431431
#[pyfunction]
432+
#[cfg_attr(
433+
not(any(unix, windows)),
434+
expect(
435+
clippy::unnecessary_wraps,
436+
reason = "WASI does not support signals yet"
437+
)
438+
)]
432439
fn valid_signals(vm: &VirtualMachine) -> PyResult {
433440
use crate::PyPayload;
434441
use crate::builtins::PySet;

crates/vm/src/stdlib/posix_compat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub(crate) mod module {
6060

6161
#[allow(dead_code)]
6262
fn os_unimpl<T>(func: &str, vm: &VirtualMachine) -> PyResult<T> {
63-
Err(vm.new_os_error(format!("{} is not supported on this platform", func)))
63+
Err(vm.new_os_error(format!("{func} is not supported on this platform")))
6464
}
6565

6666
pub(crate) fn support_funcs() -> Vec<SupportFunc> {

crates/vm/src/stdlib/time.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ mod decl {
609609
}
610610

611611
#[pyfunction]
612+
#[cfg_attr(not(any(unix, windows)), expect(clippy::unnecessary_wraps,))]
612613
fn strftime(format: PyStrRef, t: OptionalArg<StructTimeData>, vm: &VirtualMachine) -> PyResult {
613614
#[cfg(any(unix, windows))]
614615
{

0 commit comments

Comments
 (0)