Skip to content

Commit 52f81b1

Browse files
fix weird null-pointer error
1 parent 18b29b0 commit 52f81b1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/wasm/flags.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,12 @@ pub struct WasmFlags {
137137

138138
#[wasm_bindgen]
139139
impl WasmFlags {
140-
// this attribute should be at the item level at `to_js`, but it doesn't seem to work there.
140+
// these attributes should be at the item level, but they don't seem to work there.
141+
#![expect(
142+
clippy::wrong_self_convention,
143+
clippy::trivially_copy_pass_by_ref,
144+
reason = "to_js taking `self` causes weird errors when wasm-fied"
145+
)]
141146
#![expect(
142147
clippy::needless_pass_by_value,
143148
reason = "wasm-bindgen does not support &[T]"
@@ -150,7 +155,7 @@ impl WasmFlags {
150155
}
151156

152157
#[wasm_bindgen]
153-
pub fn to_js(self) -> HQResult<JsValue> {
158+
pub fn to_js(&self) -> HQResult<JsValue> {
154159
serde_wasm_bindgen::to_value(&self)
155160
.map_err(|_| make_hq_bug!("couldn't convert WasmFlags to JsValue"))
156161
}

0 commit comments

Comments
 (0)