Fix clippy warning namespaces.

This commit is contained in:
Dan Gohman
2018-12-06 02:59:39 -05:00
parent 06de604729
commit 08488591a9
11 changed files with 79 additions and 57 deletions

View File

@@ -89,7 +89,7 @@ impl Instance {
/// Return the offset from the vmctx pointer to its containing Instance.
pub fn vmctx_offset() -> isize {
offset_of!(Instance, vmctx) as isize
offset_of!(Self, vmctx) as isize
}
/// Grow memory by the specified amount of pages.
@@ -173,7 +173,7 @@ fn instantiate_tables(
for init in &module.table_elements {
debug_assert!(init.base.is_none(), "globalvar base not supported yet");
let slice = &mut tables[init.table_index].as_mut();
let slice = tables[init.table_index].as_mut();
let subslice = &mut slice[init.offset..init.offset + init.elements.len()];
for (i, func_idx) in init.elements.iter().enumerate() {
let callee_sig = module.functions[*func_idx];

View File

@@ -11,14 +11,14 @@
#![cfg_attr(
feature = "cargo-clippy",
warn(
float_arithmetic,
mut_mut,
nonminimal_bool,
option_map_unwrap_or,
option_map_unwrap_or_else,
print_stdout,
unicode_not_nfc,
use_self
clippy::float_arithmetic,
clippy::mut_mut,
clippy::nonminimal_bool,
clippy::option_map_unwrap_or,
clippy::option_map_unwrap_or_else,
clippy::print_stdout,
clippy::unicode_not_nfc,
clippy::use_self
)
)]
#![cfg_attr(not(feature = "std"), no_std)]

View File

@@ -14,6 +14,7 @@ pub extern "C" fn wasmtime_f32_trunc(x: f32) -> f32 {
x.trunc()
}
#[allow(clippy::float_arithmetic, clippy::float_cmp)]
pub extern "C" fn wasmtime_f32_nearest(x: f32) -> f32 {
// Rust doesn't have a nearest function, so do it manually.
if x == 0.0 {
@@ -50,6 +51,7 @@ pub extern "C" fn wasmtime_f64_trunc(x: f64) -> f64 {
x.trunc()
}
#[allow(clippy::float_arithmetic, clippy::float_cmp)]
pub extern "C" fn wasmtime_f64_nearest(x: f64) -> f64 {
// Rust doesn't have a nearest function, so do it manually.
if x == 0.0 {

View File

@@ -174,26 +174,32 @@ mod test_vmglobal_definition {
}
impl VMGlobalDefinition {
#[allow(cast_ptr_alignment)]
pub unsafe fn as_i32(&mut self) -> &mut i32 {
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *mut i32)
}
#[allow(cast_ptr_alignment)]
pub unsafe fn as_i64(&mut self) -> &mut i64 {
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *mut i64)
}
#[allow(cast_ptr_alignment)]
pub unsafe fn as_f32(&mut self) -> &mut f32 {
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *mut f32)
}
#[allow(cast_ptr_alignment)]
pub unsafe fn as_f32_bits(&mut self) -> &mut u32 {
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *mut u32)
}
#[allow(cast_ptr_alignment)]
pub unsafe fn as_f64(&mut self) -> &mut f64 {
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *mut f64)
}
#[allow(cast_ptr_alignment)]
pub unsafe fn as_f64_bits(&mut self) -> &mut u64 {
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *mut u64)
}
@@ -572,8 +578,8 @@ impl VMContext {
}
/// Return a mutable reference to the associated `Instance`.
#[allow(cast_ptr_alignment)]
pub unsafe fn instance(&mut self) -> &mut Instance {
&mut *((self as *mut VMContext as *mut u8).offset(-Instance::vmctx_offset())
as *mut Instance)
&mut *((self as *mut Self as *mut u8).offset(-Instance::vmctx_offset()) as *mut Instance)
}
}