You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that functions and methods which return js_sys::Promise (e.g., when creating bindings with wasm-bindgen) should probably always be marked as #[must_use]. If you invoke something which returns a Promise and then just discard it, the computation does nothing.
In order to do something useful you either have to pass the resulting Promise on to some other JS computation or convert it to a JsFuture and .await it in some async context.
There could be a lint which suggests that #[must_use] should be added for these cases to remind the user to consume the Promise.
Does this sound like something that would be appropriate as a clippy lint?
The text was updated successfully, but these errors were encountered:
It seems that functions and methods which return
js_sys::Promise
(e.g., when creating bindings withwasm-bindgen
) should probably always be marked as#[must_use]
. If you invoke something which returns aPromise
and then just discard it, the computation does nothing.In order to do something useful you either have to pass the resulting
Promise
on to some other JS computation or convert it to aJsFuture
and.await
it in some async context.There could be a lint which suggests that
#[must_use]
should be added for these cases to remind the user to consume thePromise
.Does this sound like something that would be appropriate as a clippy lint?
The text was updated successfully, but these errors were encountered: