From 85158ac22ade7538fc7fc98897438234a96b39b7 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Thu, 9 May 2019 19:53:23 -0500 Subject: [PATCH] Add some initial deny for unused_imports and unused_variables Additional unused variable fix on unix Remove unused import on unix Remove unused windows import --- lib/clif-backend/src/lib.rs | 2 ++ lib/emscripten/src/lib.rs | 2 ++ lib/emscripten/src/syscalls/unix.rs | 3 ++- lib/llvm-backend/src/lib.rs | 1 + lib/llvm-backend/src/platform/unix.rs | 2 +- lib/middleware-common/src/call_trace.rs | 2 +- lib/middleware-common/src/lib.rs | 2 ++ lib/runtime-abi/src/lib.rs | 2 ++ lib/runtime-c-api/src/lib.rs | 2 ++ lib/runtime-core/src/codegen.rs | 2 +- lib/runtime-core/src/lib.rs | 1 + lib/runtime/src/lib.rs | 2 ++ lib/singlepass-backend/src/codegen_x64.rs | 4 ++-- lib/singlepass-backend/src/lib.rs | 1 + lib/wasi/src/lib.rs | 2 ++ lib/win-exception-handler/src/exception_handling.rs | 1 - lib/win-exception-handler/src/lib.rs | 2 ++ src/bin/wasmer.rs | 2 ++ src/lib.rs | 2 ++ 19 files changed, 30 insertions(+), 7 deletions(-) diff --git a/lib/clif-backend/src/lib.rs b/lib/clif-backend/src/lib.rs index d09da6812..639249c34 100644 --- a/lib/clif-backend/src/lib.rs +++ b/lib/clif-backend/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_imports, unused_variables)] + mod cache; mod func_env; mod libcalls; diff --git a/lib/emscripten/src/lib.rs b/lib/emscripten/src/lib.rs index 54cbad632..e996fe58b 100644 --- a/lib/emscripten/src/lib.rs +++ b/lib/emscripten/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_imports, unused_variables)] + #[macro_use] extern crate wasmer_runtime_core; diff --git a/lib/emscripten/src/syscalls/unix.rs b/lib/emscripten/src/syscalls/unix.rs index a66cf3097..ec8b98f3f 100644 --- a/lib/emscripten/src/syscalls/unix.rs +++ b/lib/emscripten/src/syscalls/unix.rs @@ -1,4 +1,6 @@ use crate::varargs::VarArgs; +#[cfg(target_os = "macos")] +use libc::size_t; /// NOTE: TODO: These syscalls only support wasm_32 for now because they assume offsets are u32 /// Syscall list: https://www.cs.utexas.edu/~bismith/test/syscalls/syscalls32.html use libc::{ @@ -53,7 +55,6 @@ use libc::{ sendto, setpgid, setsockopt, - size_t, sockaddr, socket, socklen_t, diff --git a/lib/llvm-backend/src/lib.rs b/lib/llvm-backend/src/lib.rs index 1d9a030e6..c8bc50318 100644 --- a/lib/llvm-backend/src/lib.rs +++ b/lib/llvm-backend/src/lib.rs @@ -1,3 +1,4 @@ +#![deny(unused_imports, unused_variables)] #![cfg_attr(nightly, feature(unwind_attributes))] mod backend; diff --git a/lib/llvm-backend/src/platform/unix.rs b/lib/llvm-backend/src/platform/unix.rs index 12894f6bc..d16384179 100644 --- a/lib/llvm-backend/src/platform/unix.rs +++ b/lib/llvm-backend/src/platform/unix.rs @@ -34,7 +34,7 @@ pub unsafe fn visit_fde(addr: *mut u8, size: usize, visitor: extern "C" fn(*mut } #[cfg(not(target_os = "macos"))] -pub unsafe fn visit_fde(addr: *mut u8, size: usize, visitor: extern "C" fn(*mut u8)) { +pub unsafe fn visit_fde(addr: *mut u8, _size: usize, visitor: extern "C" fn(*mut u8)) { visitor(addr); } diff --git a/lib/middleware-common/src/call_trace.rs b/lib/middleware-common/src/call_trace.rs index 3f856eacd..9c47d7d7b 100644 --- a/lib/middleware-common/src/call_trace.rs +++ b/lib/middleware-common/src/call_trace.rs @@ -10,7 +10,7 @@ impl FunctionMiddleware for CallTrace { fn feed_event<'a, 'b: 'a>( &mut self, op: Event<'a, 'b>, - module_info: &ModuleInfo, + _module_info: &ModuleInfo, sink: &mut EventSink<'a, 'b>, ) -> Result<(), Self::Error> { match op { diff --git a/lib/middleware-common/src/lib.rs b/lib/middleware-common/src/lib.rs index 10c8dfd37..83b1ee35d 100644 --- a/lib/middleware-common/src/lib.rs +++ b/lib/middleware-common/src/lib.rs @@ -1 +1,3 @@ +#![deny(unused_imports, unused_variables)] + pub mod call_trace; diff --git a/lib/runtime-abi/src/lib.rs b/lib/runtime-abi/src/lib.rs index 2f0ee8c51..f4b51b1f0 100644 --- a/lib/runtime-abi/src/lib.rs +++ b/lib/runtime-abi/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_imports, unused_variables)] + #[cfg(not(target_os = "windows"))] #[macro_use] extern crate failure; diff --git a/lib/runtime-c-api/src/lib.rs b/lib/runtime-c-api/src/lib.rs index aa6455f60..6a26d6027 100644 --- a/lib/runtime-c-api/src/lib.rs +++ b/lib/runtime-c-api/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_imports, unused_variables)] + extern crate wasmer_runtime; extern crate wasmer_runtime_core; diff --git a/lib/runtime-core/src/codegen.rs b/lib/runtime-core/src/codegen.rs index 2ba85863c..296d1a740 100644 --- a/lib/runtime-core/src/codegen.rs +++ b/lib/runtime-core/src/codegen.rs @@ -1,6 +1,6 @@ use crate::{ backend::RunnableModule, - backend::{sys::Memory, Backend, CacheGen, Compiler, CompilerConfig, Token}, + backend::{Backend, CacheGen, Compiler, CompilerConfig, Token}, cache::{Artifact, Error as CacheError}, error::{CompileError, CompileResult}, module::{ModuleInfo, ModuleInner}, diff --git a/lib/runtime-core/src/lib.rs b/lib/runtime-core/src/lib.rs index 46c435db5..2a0cca431 100644 --- a/lib/runtime-core/src/lib.rs +++ b/lib/runtime-core/src/lib.rs @@ -1,3 +1,4 @@ +#![deny(unused_imports, unused_variables)] #![cfg_attr(nightly, feature(unwind_attributes))] #[cfg(test)] diff --git a/lib/runtime/src/lib.rs b/lib/runtime/src/lib.rs index 1836bb206..ba7f4440b 100644 --- a/lib/runtime/src/lib.rs +++ b/lib/runtime/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_imports, unused_variables)] + //! Wasmer-runtime is a library that makes embedding WebAssembly //! in your application easy, efficient, and safe. //! diff --git a/lib/singlepass-backend/src/codegen_x64.rs b/lib/singlepass-backend/src/codegen_x64.rs index 22687cd9f..f7868bc53 100644 --- a/lib/singlepass-backend/src/codegen_x64.rs +++ b/lib/singlepass-backend/src/codegen_x64.rs @@ -478,7 +478,7 @@ impl ModuleCodeGenerator Ok(()) } - unsafe fn from_cache(artifact: Artifact, _: Token) -> Result { + unsafe fn from_cache(_artifact: Artifact, _: Token) -> Result { Err(CacheError::Unknown( "the singlepass compiler API doesn't support caching yet".to_string(), )) @@ -1409,7 +1409,7 @@ impl FunctionCodeGenerator for X64FunctionCode { Ok(()) } - fn begin_body(&mut self, module_info: &ModuleInfo) -> Result<(), CodegenError> { + fn begin_body(&mut self, _module_info: &ModuleInfo) -> Result<(), CodegenError> { let a = self.assembler.as_mut().unwrap(); a.emit_push(Size::S64, Location::GPR(GPR::RBP)); a.emit_mov(Size::S64, Location::GPR(GPR::RSP), Location::GPR(GPR::RBP)); diff --git a/lib/singlepass-backend/src/lib.rs b/lib/singlepass-backend/src/lib.rs index 08d977487..eec02cbfd 100644 --- a/lib/singlepass-backend/src/lib.rs +++ b/lib/singlepass-backend/src/lib.rs @@ -1,3 +1,4 @@ +#![deny(unused_imports, unused_variables)] #![feature(proc_macro_hygiene)] #[cfg(not(any( diff --git a/lib/wasi/src/lib.rs b/lib/wasi/src/lib.rs index 82de5ad1f..241cc607c 100644 --- a/lib/wasi/src/lib.rs +++ b/lib/wasi/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_imports, unused_variables)] + #[macro_use] extern crate log; diff --git a/lib/win-exception-handler/src/exception_handling.rs b/lib/win-exception-handler/src/exception_handling.rs index ea36333ab..c448392b0 100644 --- a/lib/win-exception-handler/src/exception_handling.rs +++ b/lib/win-exception-handler/src/exception_handling.rs @@ -1,4 +1,3 @@ -use std::ffi::c_void; use std::ptr::NonNull; use wasmer_runtime_core::vm::{Ctx, Func}; diff --git a/lib/win-exception-handler/src/lib.rs b/lib/win-exception-handler/src/lib.rs index bc4a142b5..dfb95d0e1 100644 --- a/lib/win-exception-handler/src/lib.rs +++ b/lib/win-exception-handler/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_imports, unused_variables)] + #[cfg(windows)] mod exception_handling; diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 7760cc399..cd36651a5 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -1,3 +1,5 @@ +#![deny(unused_imports, unused_variables)] + extern crate structopt; use std::env; diff --git a/src/lib.rs b/src/lib.rs index 25af8304f..9105e278e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_imports, unused_variables)] + #[macro_use] extern crate wasmer_runtime_core; // extern crate wasmer_emscripten;