diff --git a/crates/backend/src/typegen/struct.rs b/crates/backend/src/typegen/struct.rs index e6f3d1f5..13c459f2 100644 --- a/crates/backend/src/typegen/struct.rs +++ b/crates/backend/src/typegen/struct.rs @@ -41,12 +41,10 @@ impl ToTypeDef for NapiImpl { self.name.to_string(), if resolved_type == "undefined" { "void".to_owned() + } else if is_optional { + format!("{} | null", resolved_type) } else { - if is_optional { - format!("{} | null", resolved_type) - } else { - resolved_type - } + resolved_type }, ); }); diff --git a/crates/napi/src/bindgen_runtime/js_values/string.rs b/crates/napi/src/bindgen_runtime/js_values/string.rs index 82a87b85..305d6478 100644 --- a/crates/napi/src/bindgen_runtime/js_values/string.rs +++ b/crates/napi/src/bindgen_runtime/js_values/string.rs @@ -34,7 +34,7 @@ impl ToNapiValue for &String { impl ToNapiValue for String { #[inline] unsafe fn to_napi_value(env: sys::napi_env, val: Self) -> Result { - #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] unsafe { ToNapiValue::to_napi_value(env, &val) }