mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-25 06:02:13 +00:00
Run rustfmt
This commit is contained in:
parent
93fedf85bf
commit
6c27376ac2
@ -456,7 +456,6 @@ impl TryToTokens for ast::Export {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
(
|
(
|
||||||
quote! { wasm_bindgen::JsValue },
|
quote! { wasm_bindgen::JsValue },
|
||||||
@ -467,13 +466,11 @@ impl TryToTokens for ast::Export {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if self.start {
|
} else if self.start {
|
||||||
(
|
(
|
||||||
quote! { () },
|
quote! { () },
|
||||||
quote! { <#syn_ret as wasm_bindgen::__rt::Start>::start(#ret) },
|
quote! { <#syn_ret as wasm_bindgen::__rt::Start>::start(#ret) },
|
||||||
)
|
)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
(quote! { #syn_ret }, quote! { #ret })
|
(quote! { #syn_ret }, quote! { #ret })
|
||||||
};
|
};
|
||||||
|
@ -54,10 +54,13 @@ fn runtest(test: &Path) -> Result<()> {
|
|||||||
.arg("--no-typescript");
|
.arg("--no-typescript");
|
||||||
exec(&mut bindgen)?;
|
exec(&mut bindgen)?;
|
||||||
|
|
||||||
exec(Command::new("node")
|
exec(
|
||||||
.arg("--experimental-wasm-anyref")
|
Command::new("node")
|
||||||
.arg("--experimental-wasm-mv")
|
.arg("--experimental-wasm-anyref")
|
||||||
.arg(&js).env("NODE_PATH", td.path()))?;
|
.arg("--experimental-wasm-mv")
|
||||||
|
.arg(&js)
|
||||||
|
.env("NODE_PATH", td.path()),
|
||||||
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,10 @@ fn to_vec() {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.collect::<js_sys::Array>();
|
.collect::<js_sys::Array>();
|
||||||
|
|
||||||
assert_eq!(array.to_vec(), vec![JsValue::from("a"), JsValue::from("b"), JsValue::from("c")]);
|
assert_eq!(
|
||||||
|
array.to_vec(),
|
||||||
|
vec![JsValue::from("a"), JsValue::from("b"), JsValue::from("c")]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
@ -96,7 +99,10 @@ fn iter() {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.collect::<js_sys::Array>();
|
.collect::<js_sys::Array>();
|
||||||
|
|
||||||
assert_eq!(array.iter().collect::<Vec<JsValue>>(), vec![JsValue::from("a"), JsValue::from("b"), JsValue::from("c")]);
|
assert_eq!(
|
||||||
|
array.iter().collect::<Vec<JsValue>>(),
|
||||||
|
vec![JsValue::from("a"), JsValue::from("b"), JsValue::from("c")]
|
||||||
|
);
|
||||||
|
|
||||||
let mut iter = array.iter();
|
let mut iter = array.iter();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use js_sys::*;
|
use js_sys::*;
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
use wasm_bindgen_futures::JsFuture;
|
use wasm_bindgen_futures::JsFuture;
|
||||||
|
use wasm_bindgen_test::*;
|
||||||
|
|
||||||
#[wasm_bindgen(module = "tests/wasm/Symbol.js")]
|
#[wasm_bindgen(module = "tests/wasm/Symbol.js")]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -41,7 +41,9 @@ fn iterator() {
|
|||||||
|
|
||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
async fn async_iterator() {
|
async fn async_iterator() {
|
||||||
JsFuture::from(test_async_iterator(&Symbol::async_iterator())).await.unwrap_throw();
|
JsFuture::from(test_async_iterator(&Symbol::async_iterator()))
|
||||||
|
.await
|
||||||
|
.unwrap_throw();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
@ -103,7 +105,10 @@ fn key_for() {
|
|||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
fn to_string() {
|
fn to_string() {
|
||||||
assert_eq!(Symbol::iterator().to_string(), "Symbol(Symbol.iterator)");
|
assert_eq!(Symbol::iterator().to_string(), "Symbol(Symbol.iterator)");
|
||||||
assert_eq!(Symbol::async_iterator().to_string(), "Symbol(Symbol.asyncIterator)");
|
assert_eq!(
|
||||||
|
Symbol::async_iterator().to_string(),
|
||||||
|
"Symbol(Symbol.asyncIterator)"
|
||||||
|
);
|
||||||
assert_eq!(Symbol::for_("foo").to_string(), "Symbol(foo)");
|
assert_eq!(Symbol::for_("foo").to_string(), "Symbol(foo)");
|
||||||
assert_eq!(gensym("desc".into()).to_string(), "Symbol(desc)");
|
assert_eq!(gensym("desc".into()).to_string(), "Symbol(desc)");
|
||||||
}
|
}
|
||||||
|
@ -4,4 +4,6 @@ use wasm_bindgen::prelude::*;
|
|||||||
pub fn greet(_: &str) {}
|
pub fn greet(_: &str) {}
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn take_and_return_bool(_: bool) -> bool { true }
|
pub fn take_and_return_bool(_: bool) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#![deny(missing_docs, missing_debug_implementations)]
|
#![deny(missing_docs, missing_debug_implementations)]
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, Error};
|
use anyhow::{anyhow, bail, Error};
|
||||||
use walrus::{GlobalId, GlobalKind, MemoryId, Module, ValType, InitExpr, ir::Value};
|
use walrus::{ir::Value, GlobalId, GlobalKind, InitExpr, MemoryId, Module, ValType};
|
||||||
|
|
||||||
/// Get a Wasm module's canonical linear memory.
|
/// Get a Wasm module's canonical linear memory.
|
||||||
pub fn get_memory(module: &Module) -> Result<MemoryId, Error> {
|
pub fn get_memory(module: &Module) -> Result<MemoryId, Error> {
|
||||||
|
@ -1117,7 +1117,6 @@ pub mod __rt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// An internal helper trait for usage in `#[wasm_bindgen(start)]`
|
/// An internal helper trait for usage in `#[wasm_bindgen(start)]`
|
||||||
/// functions to throw the error (if it is `Err`).
|
/// functions to throw the error (if it is `Err`).
|
||||||
pub trait Start {
|
pub trait Start {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user