mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
Run cargo fmt
over all code
This commit is contained in:
parent
3697fb7205
commit
1d0c333a2b
@ -148,7 +148,10 @@ impl<'a, 'b> Outgoing<'a, 'b> {
|
||||
|
||||
self.cx.expose_get_cached_string_from_wasm()?;
|
||||
|
||||
self.js.prelude(&format!("const v{} = getCachedStringFromWasm({}, {});", tmp, ptr, len));
|
||||
self.js.prelude(&format!(
|
||||
"const v{} = getCachedStringFromWasm({}, {});",
|
||||
tmp, ptr, len
|
||||
));
|
||||
|
||||
if *owned {
|
||||
self.prelude_free_cached_string(&ptr, &len)?;
|
||||
|
@ -287,7 +287,8 @@ impl Bindgen {
|
||||
);
|
||||
}
|
||||
|
||||
self.threads.run(&mut module)
|
||||
self.threads
|
||||
.run(&mut module)
|
||||
.with_context(|_| "failed to prepare module for threading")?;
|
||||
|
||||
// If requested, turn all mangled symbols into prettier unmangled
|
||||
|
@ -627,14 +627,10 @@ impl<'a> Context<'a> {
|
||||
// Make sure to export the `anyref` table for the JS bindings since it
|
||||
// will need to be initialized. If it doesn't exist though then the
|
||||
// module must not use it, so we skip it.
|
||||
let table = self
|
||||
.module
|
||||
.tables
|
||||
.iter()
|
||||
.find(|t| match t.kind {
|
||||
walrus::TableKind::Anyref(_) => true,
|
||||
_ => false,
|
||||
});
|
||||
let table = self.module.tables.iter().find(|t| match t.kind {
|
||||
walrus::TableKind::Anyref(_) => true,
|
||||
_ => false,
|
||||
});
|
||||
let table = match table {
|
||||
Some(t) => t.id(),
|
||||
None => return Ok(()),
|
||||
@ -642,11 +638,9 @@ impl<'a> Context<'a> {
|
||||
self.module.exports.add("__wbg_anyref_table", table);
|
||||
|
||||
let ty = self.module.types.add(&[], &[]);
|
||||
let (import, import_id) = self.module.add_import_func(
|
||||
PLACEHOLDER_MODULE,
|
||||
"__wbindgen_init_anyref_table",
|
||||
ty,
|
||||
);
|
||||
let (import, import_id) =
|
||||
self.module
|
||||
.add_import_func(PLACEHOLDER_MODULE, "__wbindgen_init_anyref_table", ty);
|
||||
|
||||
self.module.start = Some(match self.module.start {
|
||||
Some(prev_start) => {
|
||||
|
@ -1,10 +1,10 @@
|
||||
use std::cell::RefCell;
|
||||
use futures::future;
|
||||
use std::fmt;
|
||||
use std::rc::Rc;
|
||||
use futures::prelude::*;
|
||||
use futures::sync::oneshot;
|
||||
use js_sys::Promise;
|
||||
use std::cell::RefCell;
|
||||
use std::fmt;
|
||||
use std::rc::Rc;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
/// A Rust `Future` backed by a JavaScript `Promise`.
|
||||
|
@ -106,7 +106,7 @@ fn setup_clicker(document: &Document) {
|
||||
.dyn_ref::<HtmlElement>()
|
||||
.expect("#green-square be an `HtmlElement`")
|
||||
.set_onclick(Some(a.as_ref().unchecked_ref()));
|
||||
|
||||
|
||||
// See comments in `setup_clock` above for why we use `a.forget()`.
|
||||
a.forget();
|
||||
}
|
||||
|
@ -90,7 +90,8 @@ impl Scene {
|
||||
});
|
||||
drop(tx.send(rgb_data));
|
||||
})?;
|
||||
let done = rx.map(move |_data| image_data(base, len, width, height).into())
|
||||
let done = rx
|
||||
.map(move |_data| image_data(base, len, width, height).into())
|
||||
.map_err(|_| JsValue::undefined());
|
||||
|
||||
Ok(RenderingScene {
|
||||
|
@ -4,9 +4,9 @@ use std::prelude::v1::*;
|
||||
use core::slice;
|
||||
use core::str;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use crate::convert::OptionIntoWasmAbi;
|
||||
use crate::convert::{FromWasmAbi, IntoWasmAbi, RefFromWasmAbi, RefMutFromWasmAbi, WasmAbi};
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
if_std! {
|
||||
use core::mem;
|
||||
@ -124,7 +124,6 @@ vectors! {
|
||||
u8 i8 u16 i16 u32 i32 u64 i64 usize isize f32 f64
|
||||
}
|
||||
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "enable-interning")] {
|
||||
#[inline]
|
||||
@ -141,7 +140,6 @@ cfg_if! {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if_std! {
|
||||
impl<T> IntoWasmAbi for Vec<T> where Box<[T]>: IntoWasmAbi<Abi = WasmSlice> {
|
||||
type Abi = <Box<[T]> as IntoWasmAbi>::Abi;
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#![doc(hidden)]
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use crate::{Clamped, JsValue};
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
macro_rules! tys {
|
||||
($($a:ident)*) => (tys! { @ ($($a)*) 0 });
|
||||
|
@ -57,7 +57,6 @@ pub mod prelude {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub mod convert;
|
||||
pub mod describe;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user