Mark js_sys::Promise as #[must_use] (#1927)

* Mark js_sys::Promise as #[must_use]

* Fix js_sys::Promise #[must_use] warnings
This commit is contained in:
Darin Morrison 2020-01-06 07:47:16 -08:00 committed by Alex Crichton
parent 7ed152276f
commit 624ff42eae
3 changed files with 3 additions and 2 deletions

View File

@ -158,7 +158,7 @@ impl From<Promise> for JsFuture {
Closure::once(move |val| finish(&state, Err(val)))
};
js.then2(&resolve, &reject);
let _ = js.then2(&resolve, &reject);
state.borrow_mut().callbacks = Some((resolve, reject));

View File

@ -56,7 +56,7 @@ impl Queue {
// eventually we should probably use something like `queueMicrotask`:
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask
if !self.state.is_spinning.replace(true) {
self.promise.then(&self.closure);
let _ = self.promise.then(&self.closure);
}
}
}

View File

@ -4567,6 +4567,7 @@ extern "C" {
/// an asynchronous operation, and its resulting value.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
#[must_use]
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Promise;