1
0
mirror of https://github.com/fluencelabs/wasm-bindgen synced 2025-03-31 17:31:06 +00:00

Add some #[allow] directives to generated code

No need to warn about JS/Rust conventions not lining up!
This commit is contained in:
Alex Crichton 2018-03-21 10:23:03 -07:00
parent b00f8c5a28
commit 48b34604cb

@ -97,6 +97,7 @@ impl ToTokens for ast::Program {
// it'd be preferrable to generate a namespace indicator // it'd be preferrable to generate a namespace indicator
// or something like that (but modules interact weirdly // or something like that (but modules interact weirdly
// with imports and such) // with imports and such)
#[allow(bad_style)]
pub struct #ns { _priv: () } pub struct #ns { _priv: () }
impl #ns { #sub_tokens } impl #ns { #sub_tokens }
@ -343,6 +344,7 @@ impl ToTokens for ast::ImportType {
let vis = &self.vis; let vis = &self.vis;
let name = &self.name; let name = &self.name;
(my_quote! { (my_quote! {
#[allow(bad_style)]
#vis struct #name { #vis struct #name {
obj: ::wasm_bindgen::JsValue, obj: ::wasm_bindgen::JsValue,
} }
@ -566,6 +568,7 @@ impl ToTokens for ast::ImportFunction {
let invocation = my_quote! { let invocation = my_quote! {
#(#attrs)* #(#attrs)*
#[allow(bad_style)]
#vis extern #fn_token #name(#me #(#arguments),*) #ret { #vis extern #fn_token #name(#me #(#arguments),*) #ret {
::wasm_bindgen::__rt::link_this_library(); ::wasm_bindgen::__rt::link_this_library();
extern { extern {
@ -639,6 +642,7 @@ impl ToTokens for ast::ImportStatic {
let shim_name = syn::Ident::from(shim_name); let shim_name = syn::Ident::from(shim_name);
let vis = &self.vis; let vis = &self.vis;
(my_quote! { (my_quote! {
#[allow(bad_style)]
#vis static #name: ::wasm_bindgen::JsStatic<#ty> = { #vis static #name: ::wasm_bindgen::JsStatic<#ty> = {
fn init() -> #ty { fn init() -> #ty {
extern { extern {