Fixed lint issues

This commit is contained in:
Syrus
2020-05-18 15:31:11 -07:00
parent f715a74e00
commit 3050f1fa27
6 changed files with 15 additions and 21 deletions

View File

@ -58,7 +58,7 @@ test-utils = { path = "tests/lib/test-utils" }
[features] [features]
# Don't add the compiler features in default, please add them on the Makefile # Don't add the compiler features in default, please add them on the Makefile
# since we might want to autoconfigure them depending on the availability on the host. # since we might want to autoconfigure them depending on the availability on the host.
default = ["wat", "wast", "wasi", "cranelift", "cache", "jit"] default = ["wat", "wast", "wasi", "cranelift", "singlepass", "cache", "jit"]
engine = [] engine = []
jit = [ jit = [
"wasmer-engine-jit", "wasmer-engine-jit",

View File

@ -7,7 +7,7 @@ test:
doc: doc:
cargo doc --all-features --document-private-items cargo doc --all-features --document-private-items
RUSTFLAGS := "-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects -D mutable-borrow-reservation-conflict" # TODO: add `-D missing-docs` RUSTFLAGS := "-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects" # TODO: add `-D missing-docs`
lint: lint:
cargo fmt --all -- --check cargo fmt --all -- --check
RUSTFLAGS=${RUSTFLAGS} cargo clippy RUSTFLAGS=${RUSTFLAGS} cargo clippy

View File

@ -1,7 +1,7 @@
use crate::{ use crate::{
common_decl::*, config::SinglepassConfig, emitter_x64::*, machine::Machine, x64_decl::*, common_decl::*, config::SinglepassConfig, emitter_x64::*, machine::Machine, x64_decl::*,
}; };
use dynasmrt::{x64::Assembler, AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi}; use dynasmrt::{x64::Assembler, DynamicLabel};
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::iter; use std::iter;
@ -10,22 +10,18 @@ use wasm_common::{
FunctionType, FunctionType,
}; };
use wasm_common::{ use wasm_common::{
DataIndex, DataInitializer, DataInitializerLocation, ElemIndex, ExportIndex, FunctionIndex, FunctionIndex, GlobalIndex, LocalFunctionIndex, LocalGlobalIndex, LocalMemoryIndex,
GlobalIndex, GlobalType, ImportIndex, LocalFunctionIndex, LocalGlobalIndex, LocalMemoryIndex, MemoryIndex, SignatureIndex, TableIndex, Type,
LocalTableIndex, MemoryIndex, MemoryType, SignatureIndex, TableIndex, TableType, Type,
}; };
use wasmer_compiler::wasmparser::{ use wasmer_compiler::wasmparser::{
MemoryImmediate, Operator, Type as WpType, TypeOrFuncType as WpTypeOrFuncType, MemoryImmediate, Operator, Type as WpType, TypeOrFuncType as WpTypeOrFuncType,
}; };
use wasmer_compiler::{ use wasmer_compiler::{
CodeOffset, CompiledFunction, CompiledFunctionFrameInfo, CustomSection, CompiledFunction, CompiledFunctionFrameInfo, CustomSection, CustomSectionProtection,
CustomSectionProtection, FunctionBody, Relocation, RelocationKind, RelocationTarget, FunctionBody, Relocation, RelocationKind, RelocationTarget, SectionBody, SectionIndex,
SectionBody, SectionIndex, TrapInformation, TrapInformation,
};
use wasmer_runtime::{
MemoryPlan, MemoryStyle, Module, TablePlan, TableStyle, TrapCode, VMBuiltinFunctionIndex,
VMOffsets,
}; };
use wasmer_runtime::{MemoryPlan, Module, TablePlan, TrapCode, VMBuiltinFunctionIndex, VMOffsets};
/// The singlepass per-function code generator. /// The singlepass per-function code generator.
pub struct FuncGen<'a> { pub struct FuncGen<'a> {
@ -5427,7 +5423,7 @@ impl<'a> FuncGen<'a> {
self.assembler.emit_jmp(Condition::Equal, label_else); self.assembler.emit_jmp(Condition::Equal, label_else);
} }
Operator::Else => { Operator::Else => {
let mut frame = self.control_stack.last_mut().unwrap(); let frame = self.control_stack.last_mut().unwrap();
if !was_unreachable && frame.returns.len() > 0 { if !was_unreachable && frame.returns.len() > 0 {
let first_return = frame.returns[0]; let first_return = frame.returns[0];
@ -5568,7 +5564,7 @@ impl<'a> FuncGen<'a> {
Operator::Loop { ty } => { Operator::Loop { ty } => {
let label = self.assembler.get_label(); let label = self.assembler.get_label();
let state_diff_id = self.get_state_diff(); let state_diff_id = self.get_state_diff();
let activate_offset = self.assembler.get_offset().0; let _activate_offset = self.assembler.get_offset().0;
self.control_stack.push(ControlFrame { self.control_stack.push(ControlFrame {
label: label, label: label,

View File

@ -53,7 +53,7 @@ impl Compiler for SinglepassCompiler {
fn compile_module( fn compile_module(
&self, &self,
module: &Module, module: &Module,
module_translation: &ModuleTranslationState, _module_translation: &ModuleTranslationState,
function_body_inputs: PrimaryMap<LocalFunctionIndex, FunctionBodyData<'_>>, function_body_inputs: PrimaryMap<LocalFunctionIndex, FunctionBodyData<'_>>,
memory_plans: PrimaryMap<MemoryIndex, MemoryPlan>, memory_plans: PrimaryMap<MemoryIndex, MemoryPlan>,
table_plans: PrimaryMap<TableIndex, TablePlan>, table_plans: PrimaryMap<TableIndex, TablePlan>,
@ -131,7 +131,7 @@ impl Compiler for SinglepassCompiler {
fn compile_dynamic_function_trampolines( fn compile_dynamic_function_trampolines(
&self, &self,
module: &Module, _module: &Module,
) -> Result<PrimaryMap<FunctionIndex, FunctionBody>, CompileError> { ) -> Result<PrimaryMap<FunctionIndex, FunctionBody>, CompileError> {
Ok(PrimaryMap::new()) Ok(PrimaryMap::new())
// unimplemented!("Dynamic funciton trampolines not yet implemented"); // unimplemented!("Dynamic funciton trampolines not yet implemented");

View File

@ -5,7 +5,7 @@ use wasm_common::entity::{EntityRef, PrimaryMap};
use wasm_common::LocalFunctionIndex; use wasm_common::LocalFunctionIndex;
use wasmer_compiler::{ use wasmer_compiler::{
JumpTable, JumpTableOffsets, Relocation, RelocationKind, RelocationTarget, Relocations, JumpTable, JumpTableOffsets, Relocation, RelocationKind, RelocationTarget, Relocations,
SectionBody, SectionIndex, SectionIndex,
}; };
use wasmer_runtime::Module; use wasmer_runtime::Module;
use wasmer_runtime::VMFunctionBody; use wasmer_runtime::VMFunctionBody;

View File

@ -5,9 +5,7 @@ use wasm_common::{
Features, FunctionIndex, LocalFunctionIndex, MemoryIndex, OwnedDataInitializer, SignatureIndex, Features, FunctionIndex, LocalFunctionIndex, MemoryIndex, OwnedDataInitializer, SignatureIndex,
TableIndex, TableIndex,
}; };
use wasmer_compiler::{ use wasmer_compiler::{CustomSection, FunctionBody, JumpTableOffsets, Relocation, SectionIndex};
CustomSection, FunctionBody, JumpTableOffsets, Relocation, SectionBody, SectionIndex,
};
use wasmer_engine::SerializableFunctionFrameInfo; use wasmer_engine::SerializableFunctionFrameInfo;
use wasmer_runtime::Module; use wasmer_runtime::Module;
use wasmer_runtime::{MemoryPlan, TablePlan}; use wasmer_runtime::{MemoryPlan, TablePlan};