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]
# 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.
default = ["wat", "wast", "wasi", "cranelift", "cache", "jit"]
default = ["wat", "wast", "wasi", "cranelift", "singlepass", "cache", "jit"]
engine = []
jit = [
"wasmer-engine-jit",

View File

@ -7,7 +7,7 @@ test:
doc:
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:
cargo fmt --all -- --check
RUSTFLAGS=${RUSTFLAGS} cargo clippy

View File

@ -1,7 +1,7 @@
use crate::{
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 std::collections::BTreeMap;
use std::iter;
@ -10,22 +10,18 @@ use wasm_common::{
FunctionType,
};
use wasm_common::{
DataIndex, DataInitializer, DataInitializerLocation, ElemIndex, ExportIndex, FunctionIndex,
GlobalIndex, GlobalType, ImportIndex, LocalFunctionIndex, LocalGlobalIndex, LocalMemoryIndex,
LocalTableIndex, MemoryIndex, MemoryType, SignatureIndex, TableIndex, TableType, Type,
FunctionIndex, GlobalIndex, LocalFunctionIndex, LocalGlobalIndex, LocalMemoryIndex,
MemoryIndex, SignatureIndex, TableIndex, Type,
};
use wasmer_compiler::wasmparser::{
MemoryImmediate, Operator, Type as WpType, TypeOrFuncType as WpTypeOrFuncType,
};
use wasmer_compiler::{
CodeOffset, CompiledFunction, CompiledFunctionFrameInfo, CustomSection,
CustomSectionProtection, FunctionBody, Relocation, RelocationKind, RelocationTarget,
SectionBody, SectionIndex, TrapInformation,
};
use wasmer_runtime::{
MemoryPlan, MemoryStyle, Module, TablePlan, TableStyle, TrapCode, VMBuiltinFunctionIndex,
VMOffsets,
CompiledFunction, CompiledFunctionFrameInfo, CustomSection, CustomSectionProtection,
FunctionBody, Relocation, RelocationKind, RelocationTarget, SectionBody, SectionIndex,
TrapInformation,
};
use wasmer_runtime::{MemoryPlan, Module, TablePlan, TrapCode, VMBuiltinFunctionIndex, VMOffsets};
/// The singlepass per-function code generator.
pub struct FuncGen<'a> {
@ -5427,7 +5423,7 @@ impl<'a> FuncGen<'a> {
self.assembler.emit_jmp(Condition::Equal, label_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 {
let first_return = frame.returns[0];
@ -5568,7 +5564,7 @@ impl<'a> FuncGen<'a> {
Operator::Loop { ty } => {
let label = self.assembler.get_label();
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 {
label: label,

View File

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

View File

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

View File

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