Skip to content

Commit

Permalink
Multiple lint improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Apr 29, 2020
1 parent a03f0ba commit e0bdb47
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 18 deletions.
15 changes: 10 additions & 5 deletions lib/api/src/externals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use std::slice;
use wasm_common::{Bytes, HostFunction, Pages, ValueType, WasmTypeList, WithEnv, WithoutEnv};
use wasmer_runtime::{
wasmer_call_trampoline, Export, ExportFunction, ExportGlobal, ExportMemory, ExportTable,
Table as RuntimeTable, VMCallerCheckedAnyfunc, VMContext, VMFunctionBody, VMGlobalDefinition,
VMMemoryDefinition, VMTrampoline,
LinearMemory, Table as RuntimeTable, VMCallerCheckedAnyfunc, VMContext, VMFunctionBody,
VMGlobalDefinition, VMMemoryDefinition, VMTrampoline,
};

#[derive(Clone)]
Expand Down Expand Up @@ -249,7 +249,7 @@ impl Table {
}

fn table(&self) -> &RuntimeTable {
unsafe { (&*self.exported.from) }
unsafe { &*self.exported.from }
}

pub fn ty(&self) -> &TableType {
Expand Down Expand Up @@ -391,9 +391,14 @@ impl Memory {
Bytes(self.data_size()).into()
}

pub fn grow(&self, delta: Pages) -> Result<Pages, RuntimeError> {
Ok(unsafe { (&*self.exported.from) }.grow(delta).unwrap())
fn memory(&self) -> &LinearMemory {
unsafe { &*self.exported.from }
}

pub fn grow(&self, delta: Pages) -> Option<Pages> {
self.memory().grow(delta)
}

/// Return a "view" of the currently accessible memory. By
/// default, the view is unsynchronized, using regular memory
/// accesses. You can force a memory view to use atomic accesses
Expand Down
2 changes: 0 additions & 2 deletions lib/compiler-cranelift/src/debug/address_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
// addresses of a WebAssembly module into the native code.

use cranelift_codegen::ir;
use serde::{Deserialize, Serialize};
use wasm_common::entity::PrimaryMap;
use wasm_common::LocalFuncIndex;
use wasmer_compiler::SourceLoc;

/// Value ranges for functions.
pub type ValueLabelsRanges = PrimaryMap<LocalFuncIndex, cranelift_codegen::ValueLabelsRanges>;
Expand Down
1 change: 0 additions & 1 deletion lib/jit/src/instantiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ impl RawCompiledModule {
.translate(data)
.map_err(|error| CompileError::Wasm(error))?;

let tunables = jit.tunables();
let memory_plans: PrimaryMap<MemoryIndex, MemoryPlan> = translation
.module
.memories
Expand Down
9 changes: 3 additions & 6 deletions lib/jit/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ use crate::error::{ImportError, LinkError};
use more_asserts::assert_ge;
use std::collections::HashSet;
use wasm_common::entity::PrimaryMap;
use wasm_common::{
ExternType, GlobalInit, GlobalType, ImportIndex, MemoryIndex, MemoryType, TableIndex,
TableType, Type,
};
use wasm_common::{ExternType, ImportIndex, MemoryIndex, TableIndex};
use wasmer_runtime::{
Export, Imports, SignatureRegistry, VMFunctionImport, VMGlobalImport, VMMemoryImport,
VMTableImport,
Expand Down Expand Up @@ -63,7 +60,7 @@ fn get_extern_from_import(module: &Module, import_index: &ImportIndex) -> Extern

/// Get an `ExternType` given an export (and signatures in case is a function).
fn get_extern_from_export(
module: &Module,
_module: &Module,
signatures: &SignatureRegistry,
export: &Export,
) -> ExternType {
Expand Down Expand Up @@ -96,7 +93,7 @@ pub fn resolve_imports(
signatures: &SignatureRegistry,
resolver: &dyn Resolver,
memory_plans: &PrimaryMap<MemoryIndex, MemoryPlan>,
table_plans: &PrimaryMap<TableIndex, TablePlan>,
_table_plans: &PrimaryMap<TableIndex, TablePlan>,
) -> Result<Imports, LinkError> {
let dependencies = HashSet::new();

Expand Down
1 change: 0 additions & 1 deletion lib/runtime/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::module::{MemoryPlan, MemoryStyle};
use crate::vmcontext::VMMemoryDefinition;
use more_asserts::{assert_ge, assert_le};
use std::cell::RefCell;
use std::convert::TryFrom;
use wasm_common::Pages;

/// A linear memory instance.
Expand Down
4 changes: 1 addition & 3 deletions src/commands/run.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::common::get_cache_dir;
// use crate::common::get_cache_dir;
use crate::compiler::CompilerOptions;
use anyhow::{anyhow, bail, Context, Result};
use std::collections::HashMap;
use std::fs;
use std::path::PathBuf;
use wasmer::*;

Expand Down

0 comments on commit e0bdb47

Please sign in to comment.