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:
Alex Crichton 2018-04-19 13:16:59 -07:00
parent 574e54a89d
commit 792a8e132e
5 changed files with 8 additions and 9 deletions

View File

@ -129,7 +129,7 @@ impl ToTokens for ast::Struct {
impl ::wasm_bindgen::convert::FromWasmAbi for #name {
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
{
let ptr = js as *mut ::wasm_bindgen::__rt::WasmRefCell<#name>;

View File

@ -291,13 +291,13 @@ fn issue_27() {
#[wasm_bindgen]
impl Context {
pub fn parse(&self, expr: &str) -> Expr {
pub fn parse(&self, _expr: &str) -> Expr {
panic!()
}
pub fn eval(&self, expr: &Expr) -> f64 {
pub fn eval(&self, _expr: &Expr) -> f64 {
panic!()
}
pub fn set(&mut self, var: &str, val: f64) {
pub fn set(&mut self, _var: &str, _val: f64) {
panic!()
}
}

View File

@ -294,7 +294,6 @@ fn long_fnmut_recursive() {
extern crate wasm_bindgen;
use std::cell::Cell;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "./test")]
@ -336,7 +335,6 @@ fn fnmut() {
extern crate wasm_bindgen;
use std::cell::Cell;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "./test")]
@ -385,7 +383,6 @@ fn fnmut_bad() {
extern crate wasm_bindgen;
use std::cell::Cell;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "./test")]
@ -441,7 +438,6 @@ fn string_arguments() {
extern crate wasm_bindgen;
use std::cell::Cell;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "./test")]

View File

@ -87,6 +87,7 @@ fn unused() {
project()
.file("src/lib.rs", r#"
#![feature(proc_macro, wasm_custom_section, wasm_import_module)]
#![allow(dead_code)]
extern crate wasm_bindgen;

View File

@ -169,7 +169,9 @@ impl Project {
.arg("--target")
.arg("wasm32-unknown-unknown")
.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");
let idx = IDX.with(|x| *x);