mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-11-28 05:52:21 +03:00
Fix unused variables in generated code
Also deny all warnings in tests to prevent this creeping back in. Closes #141
This commit is contained in:
parent
574e54a89d
commit
792a8e132e
@ -129,7 +129,7 @@ impl ToTokens for ast::Struct {
|
|||||||
impl ::wasm_bindgen::convert::FromWasmAbi for #name {
|
impl ::wasm_bindgen::convert::FromWasmAbi for #name {
|
||||||
type Abi = u32;
|
type Abi = u32;
|
||||||
|
|
||||||
unsafe fn from_abi(js: u32, extra: &mut ::wasm_bindgen::convert::Stack)
|
unsafe fn from_abi(js: u32, _extra: &mut ::wasm_bindgen::convert::Stack)
|
||||||
-> Self
|
-> Self
|
||||||
{
|
{
|
||||||
let ptr = js as *mut ::wasm_bindgen::__rt::WasmRefCell<#name>;
|
let ptr = js as *mut ::wasm_bindgen::__rt::WasmRefCell<#name>;
|
||||||
|
@ -291,13 +291,13 @@ fn issue_27() {
|
|||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
impl Context {
|
impl Context {
|
||||||
pub fn parse(&self, expr: &str) -> Expr {
|
pub fn parse(&self, _expr: &str) -> Expr {
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
pub fn eval(&self, expr: &Expr) -> f64 {
|
pub fn eval(&self, _expr: &Expr) -> f64 {
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
pub fn set(&mut self, var: &str, val: f64) {
|
pub fn set(&mut self, _var: &str, _val: f64) {
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,6 @@ fn long_fnmut_recursive() {
|
|||||||
|
|
||||||
extern crate wasm_bindgen;
|
extern crate wasm_bindgen;
|
||||||
|
|
||||||
use std::cell::Cell;
|
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
#[wasm_bindgen(module = "./test")]
|
#[wasm_bindgen(module = "./test")]
|
||||||
@ -336,7 +335,6 @@ fn fnmut() {
|
|||||||
|
|
||||||
extern crate wasm_bindgen;
|
extern crate wasm_bindgen;
|
||||||
|
|
||||||
use std::cell::Cell;
|
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
#[wasm_bindgen(module = "./test")]
|
#[wasm_bindgen(module = "./test")]
|
||||||
@ -385,7 +383,6 @@ fn fnmut_bad() {
|
|||||||
|
|
||||||
extern crate wasm_bindgen;
|
extern crate wasm_bindgen;
|
||||||
|
|
||||||
use std::cell::Cell;
|
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
#[wasm_bindgen(module = "./test")]
|
#[wasm_bindgen(module = "./test")]
|
||||||
@ -441,7 +438,6 @@ fn string_arguments() {
|
|||||||
|
|
||||||
extern crate wasm_bindgen;
|
extern crate wasm_bindgen;
|
||||||
|
|
||||||
use std::cell::Cell;
|
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
#[wasm_bindgen(module = "./test")]
|
#[wasm_bindgen(module = "./test")]
|
||||||
|
@ -87,6 +87,7 @@ fn unused() {
|
|||||||
project()
|
project()
|
||||||
.file("src/lib.rs", r#"
|
.file("src/lib.rs", r#"
|
||||||
#![feature(proc_macro, wasm_custom_section, wasm_import_module)]
|
#![feature(proc_macro, wasm_custom_section, wasm_import_module)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
extern crate wasm_bindgen;
|
extern crate wasm_bindgen;
|
||||||
|
|
||||||
|
@ -169,7 +169,9 @@ impl Project {
|
|||||||
.arg("--target")
|
.arg("--target")
|
||||||
.arg("wasm32-unknown-unknown")
|
.arg("wasm32-unknown-unknown")
|
||||||
.current_dir(&root)
|
.current_dir(&root)
|
||||||
.env("CARGO_TARGET_DIR", &target_dir);
|
.env("CARGO_TARGET_DIR", &target_dir)
|
||||||
|
// Catch any warnings in generated code because we don't want any
|
||||||
|
.env("RUSTFLAGS", "-Dwarnings");
|
||||||
run(&mut cmd, "cargo");
|
run(&mut cmd, "cargo");
|
||||||
|
|
||||||
let idx = IDX.with(|x| *x);
|
let idx = IDX.with(|x| *x);
|
||||||
|
Loading…
Reference in New Issue
Block a user