diff --git a/tests/wasm/classes.rs b/tests/wasm/classes.rs index 6058c0a59da..e590cf7e2eb 100644 --- a/tests/wasm/classes.rs +++ b/tests/wasm/classes.rs @@ -451,9 +451,7 @@ impl RenamedExport { } pub fn foo(&self) {} - pub fn bar(&self, other: &RenamedExport) { - drop(other); - } + pub fn bar(&self, _: &RenamedExport) {} } #[wasm_bindgen_test] diff --git a/tests/wasm/closures.rs b/tests/wasm/closures.rs index 1061dab5ab9..a0247b5d1ca 100644 --- a/tests/wasm/closures.rs +++ b/tests/wasm/closures.rs @@ -432,7 +432,9 @@ fn drop_drops() { } } let a = A; - let x: Closure = Closure::new(move || drop(&a)); + let x: Closure = Closure::new(move || { + let _ = a; + }); drop(x); unsafe { assert!(HIT); @@ -605,25 +607,33 @@ fn call_destroyed_doesnt_segfault() { } let a = A(1, 1); - let a = Closure::wrap(Box::new(move || drop(&a)) as Box); + let a = Closure::wrap(Box::new(move || { + let _ = a; + }) as Box); let b = a.as_ref().clone(); drop(a); call_destroyed(&b); let a = A(2, 2); - let a = Closure::wrap(Box::new(move || drop(&a)) as Box); + let a = Closure::wrap(Box::new(move || { + let _ = a; + }) as Box); let b = a.as_ref().clone(); drop(a); call_destroyed(&b); let a = A(1, 1); - let a = Closure::wrap(Box::new(move |_: &JsValue| drop(&a)) as Box); + let a = Closure::wrap(Box::new(move |_: &JsValue| { + let _ = a; + }) as Box); let b = a.as_ref().clone(); drop(a); call_destroyed(&b); let a = A(2, 2); - let a = Closure::wrap(Box::new(move |_: &JsValue| drop(&a)) as Box); + let a = Closure::wrap(Box::new(move |_: &JsValue| { + let _ = a; + }) as Box); let b = a.as_ref().clone(); drop(a); call_destroyed(&b);