Merge pull request #621 from wasmerio/feature/add-deny-dead_code-lint

Add deny dead_code lint and fix one error
This commit is contained in:
Syrus Akbary 2019-08-02 13:36:53 -07:00 committed by GitHub
commit 17b5082c9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 99 additions and 30 deletions

View File

@ -89,7 +89,6 @@ impl ModuleCodeGenerator<CraneliftFunctionCodeGenerator, Caller, CodegenError>
func,
func_translator,
next_local: 0,
module_info: Arc::clone(&module_info),
position: Position::default(),
func_env: FunctionEnvironment {
module_info: Arc::clone(&module_info),
@ -394,7 +393,6 @@ pub struct CraneliftFunctionCodeGenerator {
func: Function,
func_translator: FuncTranslator,
next_local: usize,
module_info: Arc<RwLock<ModuleInfo>>,
position: Position,
func_env: FunctionEnvironment,
}

View File

@ -1,5 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
mod cache;
mod code;
mod libcalls;

View File

@ -30,6 +30,7 @@ pub fn call_malloc(ctx: &mut Ctx, size: u32) -> u32 {
.unwrap()
}
#[warn(dead_code)]
pub fn call_malloc_with_cast<T: Copy, Ty>(ctx: &mut Ctx, size: u32) -> WasmPtr<T, Ty> {
WasmPtr::new(call_malloc(ctx, size))
}

View File

@ -1,5 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
#[macro_use]
extern crate wasmer_runtime_core;
@ -25,11 +30,11 @@ use wasmer_runtime_core::{
};
#[cfg(unix)]
use ::libc::DIR as libcDIR;
use ::libc::DIR as LibcDir;
// We use a placeholder for windows
#[cfg(not(unix))]
type libcDIR = u8;
type LibcDir = u8;
#[macro_use]
mod macros;
@ -93,7 +98,7 @@ pub struct EmscriptenData<'a> {
pub memset: Option<Func<'a, (u32, u32, u32), u32>>,
pub stack_alloc: Option<Func<'a, u32, u32>>,
pub jumps: Vec<UnsafeCell<[u32; 27]>>,
pub opened_dirs: HashMap<i32, Box<*mut libcDIR>>,
pub opened_dirs: HashMap<i32, Box<*mut LibcDir>>,
pub dyn_call_i: Option<Func<'a, i32, i32>>,
pub dyn_call_ii: Option<Func<'a, (i32, i32), i32>>,

View File

@ -1,4 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
#![cfg_attr(nightly, feature(unwind_attributes))]
mod backend;

View File

@ -1,4 +1,9 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
pub mod call_trace;
pub mod metering;

View File

@ -1,5 +1,4 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(dead_code, unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#[cfg(not(target_os = "windows"))]
#[macro_use]
extern crate failure;

View File

@ -80,8 +80,13 @@
//!
//! [wasmer_h]: ./wasmer.h
//! [wasmer_hh]: ./wasmer.hh
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
extern crate wasmer_runtime;
extern crate wasmer_runtime_core;

View File

@ -1,4 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
#![cfg_attr(nightly, feature(unwind_attributes))]
#[cfg(test)]

View File

@ -100,6 +100,7 @@ pub struct InstanceImage {
}
impl ModuleStateMap {
#[warn(dead_code)]
fn lookup_call_ip(&self, ip: usize, base: usize) -> Option<(&FunctionStateMap, MachineState)> {
if ip < base || ip - base >= self.total_size {
None
@ -123,6 +124,7 @@ impl ModuleStateMap {
}
}
#[warn(dead_code)]
fn lookup_trappable_ip(
&self,
ip: usize,
@ -150,6 +152,7 @@ impl ModuleStateMap {
}
}
#[warn(dead_code)]
fn lookup_loop_ip(&self, ip: usize, base: usize) -> Option<(&FunctionStateMap, MachineState)> {
if ip < base || ip - base >= self.total_size {
None

View File

@ -1,5 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
//! Wasmer-runtime is a library that makes embedding WebAssembly
//! in your application easy, efficient, and safe.
//!

View File

@ -1,4 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
#![feature(proc_macro_hygiene)]
#[cfg(not(any(

View File

@ -1,5 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
#[cfg(target = "windows")]
extern crate winapi;

View File

@ -1,5 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
#[cfg(windows)]
mod exception_handling;

View File

@ -1,5 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
extern crate byteorder;
extern crate structopt;

View File

@ -1,5 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
extern crate structopt;
use std::env;

View File

@ -1,5 +1,10 @@
#![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
#![deny(
dead_code,
unused_imports,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
#[macro_use]
extern crate wasmer_runtime_core;
// extern crate wasmer_emscripten;