Fix clippy warning namespaces.
This commit is contained in:
@@ -14,14 +14,14 @@
|
|||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
float_arithmetic,
|
clippy::float_arithmetic,
|
||||||
mut_mut,
|
clippy::mut_mut,
|
||||||
nonminimal_bool,
|
clippy::nonminimal_bool,
|
||||||
option_map_unwrap_or,
|
clippy::option_map_unwrap_or,
|
||||||
option_map_unwrap_or_else,
|
clippy::option_map_unwrap_or_else,
|
||||||
print_stdout,
|
clippy::print_stdout,
|
||||||
unicode_not_nfc,
|
clippy::unicode_not_nfc,
|
||||||
use_self
|
clippy::use_self
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|||||||
@@ -17,11 +17,13 @@ impl VMOffsets {
|
|||||||
/// Offsets for `wasmtime_execute::VMMemoryDefinition`.
|
/// Offsets for `wasmtime_execute::VMMemoryDefinition`.
|
||||||
impl VMOffsets {
|
impl VMOffsets {
|
||||||
/// The offset of the `base` field.
|
/// The offset of the `base` field.
|
||||||
|
#[allow(clippy::erasing_op)]
|
||||||
pub fn vmmemory_definition_base(&self) -> u8 {
|
pub fn vmmemory_definition_base(&self) -> u8 {
|
||||||
0 * self.pointer_size
|
0 * self.pointer_size
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The offset of the `current_length` field.
|
/// The offset of the `current_length` field.
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
pub fn vmmemory_definition_current_length(&self) -> u8 {
|
pub fn vmmemory_definition_current_length(&self) -> u8 {
|
||||||
1 * self.pointer_size
|
1 * self.pointer_size
|
||||||
}
|
}
|
||||||
@@ -35,11 +37,13 @@ impl VMOffsets {
|
|||||||
/// Offsets for `wasmtime_execute::VMMemoryImport`.
|
/// Offsets for `wasmtime_execute::VMMemoryImport`.
|
||||||
impl VMOffsets {
|
impl VMOffsets {
|
||||||
/// The offset of the `from` field.
|
/// The offset of the `from` field.
|
||||||
|
#[allow(clippy::erasing_op)]
|
||||||
pub fn vmmemory_import_from(&self) -> u8 {
|
pub fn vmmemory_import_from(&self) -> u8 {
|
||||||
0 * self.pointer_size
|
0 * self.pointer_size
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the size of `VMMemoryImport`.
|
/// Return the size of `VMMemoryImport`.
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
pub fn size_of_vmmemory_import(&self) -> u8 {
|
pub fn size_of_vmmemory_import(&self) -> u8 {
|
||||||
1 * self.pointer_size
|
1 * self.pointer_size
|
||||||
}
|
}
|
||||||
@@ -64,11 +68,13 @@ impl VMOffsets {
|
|||||||
/// Offsets for `wasmtime_execute::VMGlobalImport`.
|
/// Offsets for `wasmtime_execute::VMGlobalImport`.
|
||||||
impl VMOffsets {
|
impl VMOffsets {
|
||||||
/// The offset of the `from` field.
|
/// The offset of the `from` field.
|
||||||
|
#[allow(clippy::erasing_op)]
|
||||||
pub fn vmglobal_import_from(&self) -> u8 {
|
pub fn vmglobal_import_from(&self) -> u8 {
|
||||||
0 * self.pointer_size
|
0 * self.pointer_size
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the size of `VMGlobalImport`.
|
/// Return the size of `VMGlobalImport`.
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
pub fn size_of_vmglobal_import(&self) -> u8 {
|
pub fn size_of_vmglobal_import(&self) -> u8 {
|
||||||
1 * self.pointer_size
|
1 * self.pointer_size
|
||||||
}
|
}
|
||||||
@@ -86,11 +92,13 @@ impl VMOffsets {
|
|||||||
/// Offsets for `wasmtime_execute::VMTableDefinition`.
|
/// Offsets for `wasmtime_execute::VMTableDefinition`.
|
||||||
impl VMOffsets {
|
impl VMOffsets {
|
||||||
/// The offset of the `base` field.
|
/// The offset of the `base` field.
|
||||||
|
#[allow(clippy::erasing_op)]
|
||||||
pub fn vmtable_definition_base(&self) -> u8 {
|
pub fn vmtable_definition_base(&self) -> u8 {
|
||||||
0 * self.pointer_size
|
0 * self.pointer_size
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The offset of the `current_elements` field.
|
/// The offset of the `current_elements` field.
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
pub fn vmtable_definition_current_elements(&self) -> u8 {
|
pub fn vmtable_definition_current_elements(&self) -> u8 {
|
||||||
1 * self.pointer_size
|
1 * self.pointer_size
|
||||||
}
|
}
|
||||||
@@ -104,11 +112,13 @@ impl VMOffsets {
|
|||||||
/// Offsets for `wasmtime_execute::VMTableImport`.
|
/// Offsets for `wasmtime_execute::VMTableImport`.
|
||||||
impl VMOffsets {
|
impl VMOffsets {
|
||||||
/// The offset of the `from` field.
|
/// The offset of the `from` field.
|
||||||
|
#[allow(clippy::erasing_op)]
|
||||||
pub fn vmtable_import_from(&self) -> u8 {
|
pub fn vmtable_import_from(&self) -> u8 {
|
||||||
0 * self.pointer_size
|
0 * self.pointer_size
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the size of `VMTableImport`.
|
/// Return the size of `VMTableImport`.
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
pub fn size_of_vmtable_import(&self) -> u8 {
|
pub fn size_of_vmtable_import(&self) -> u8 {
|
||||||
1 * self.pointer_size
|
1 * self.pointer_size
|
||||||
}
|
}
|
||||||
@@ -133,11 +143,13 @@ impl VMOffsets {
|
|||||||
/// Offsets for `wasmtime_execute::VMCallerCheckedAnyfunc`.
|
/// Offsets for `wasmtime_execute::VMCallerCheckedAnyfunc`.
|
||||||
impl VMOffsets {
|
impl VMOffsets {
|
||||||
/// The offset of the `func_ptr` field.
|
/// The offset of the `func_ptr` field.
|
||||||
|
#[allow(clippy::erasing_op)]
|
||||||
pub fn vmcaller_checked_anyfunc_func_ptr(&self) -> u8 {
|
pub fn vmcaller_checked_anyfunc_func_ptr(&self) -> u8 {
|
||||||
0 * self.pointer_size
|
0 * self.pointer_size
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The offset of the `type_id` field.
|
/// The offset of the `type_id` field.
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
pub fn vmcaller_checked_anyfunc_type_id(&self) -> u8 {
|
pub fn vmcaller_checked_anyfunc_type_id(&self) -> u8 {
|
||||||
1 * self.pointer_size
|
1 * self.pointer_size
|
||||||
}
|
}
|
||||||
@@ -151,11 +163,13 @@ impl VMOffsets {
|
|||||||
/// Offsets for `wasmtime_execute::VMContext`.
|
/// Offsets for `wasmtime_execute::VMContext`.
|
||||||
impl VMOffsets {
|
impl VMOffsets {
|
||||||
/// The offset of the `memories` field.
|
/// The offset of the `memories` field.
|
||||||
|
#[allow(clippy::erasing_op)]
|
||||||
pub fn vmctx_memories(&self) -> u8 {
|
pub fn vmctx_memories(&self) -> u8 {
|
||||||
0 * self.pointer_size
|
0 * self.pointer_size
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The offset of the `globals` field.
|
/// The offset of the `globals` field.
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
pub fn vmctx_globals(&self) -> u8 {
|
pub fn vmctx_globals(&self) -> u8 {
|
||||||
1 * self.pointer_size
|
1 * self.pointer_size
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ impl Instance {
|
|||||||
|
|
||||||
/// Return the offset from the vmctx pointer to its containing Instance.
|
/// Return the offset from the vmctx pointer to its containing Instance.
|
||||||
pub fn vmctx_offset() -> isize {
|
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.
|
/// Grow memory by the specified amount of pages.
|
||||||
@@ -173,7 +173,7 @@ fn instantiate_tables(
|
|||||||
|
|
||||||
for init in &module.table_elements {
|
for init in &module.table_elements {
|
||||||
debug_assert!(init.base.is_none(), "globalvar base not supported yet");
|
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()];
|
let subslice = &mut slice[init.offset..init.offset + init.elements.len()];
|
||||||
for (i, func_idx) in init.elements.iter().enumerate() {
|
for (i, func_idx) in init.elements.iter().enumerate() {
|
||||||
let callee_sig = module.functions[*func_idx];
|
let callee_sig = module.functions[*func_idx];
|
||||||
|
|||||||
@@ -11,14 +11,14 @@
|
|||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
float_arithmetic,
|
clippy::float_arithmetic,
|
||||||
mut_mut,
|
clippy::mut_mut,
|
||||||
nonminimal_bool,
|
clippy::nonminimal_bool,
|
||||||
option_map_unwrap_or,
|
clippy::option_map_unwrap_or,
|
||||||
option_map_unwrap_or_else,
|
clippy::option_map_unwrap_or_else,
|
||||||
print_stdout,
|
clippy::print_stdout,
|
||||||
unicode_not_nfc,
|
clippy::unicode_not_nfc,
|
||||||
use_self
|
clippy::use_self
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ pub extern "C" fn wasmtime_f32_trunc(x: f32) -> f32 {
|
|||||||
x.trunc()
|
x.trunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::float_arithmetic, clippy::float_cmp)]
|
||||||
pub extern "C" fn wasmtime_f32_nearest(x: f32) -> f32 {
|
pub extern "C" fn wasmtime_f32_nearest(x: f32) -> f32 {
|
||||||
// Rust doesn't have a nearest function, so do it manually.
|
// Rust doesn't have a nearest function, so do it manually.
|
||||||
if x == 0.0 {
|
if x == 0.0 {
|
||||||
@@ -50,6 +51,7 @@ pub extern "C" fn wasmtime_f64_trunc(x: f64) -> f64 {
|
|||||||
x.trunc()
|
x.trunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::float_arithmetic, clippy::float_cmp)]
|
||||||
pub extern "C" fn wasmtime_f64_nearest(x: f64) -> f64 {
|
pub extern "C" fn wasmtime_f64_nearest(x: f64) -> f64 {
|
||||||
// Rust doesn't have a nearest function, so do it manually.
|
// Rust doesn't have a nearest function, so do it manually.
|
||||||
if x == 0.0 {
|
if x == 0.0 {
|
||||||
|
|||||||
@@ -174,26 +174,32 @@ mod test_vmglobal_definition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VMGlobalDefinition {
|
impl VMGlobalDefinition {
|
||||||
|
#[allow(cast_ptr_alignment)]
|
||||||
pub unsafe fn as_i32(&mut self) -> &mut i32 {
|
pub unsafe fn as_i32(&mut self) -> &mut i32 {
|
||||||
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *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 {
|
pub unsafe fn as_i64(&mut self) -> &mut i64 {
|
||||||
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *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 {
|
pub unsafe fn as_f32(&mut self) -> &mut f32 {
|
||||||
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *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 {
|
pub unsafe fn as_f32_bits(&mut self) -> &mut u32 {
|
||||||
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *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 {
|
pub unsafe fn as_f64(&mut self) -> &mut f64 {
|
||||||
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *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 {
|
pub unsafe fn as_f64_bits(&mut self) -> &mut u64 {
|
||||||
&mut *(self.storage.as_mut().as_mut_ptr() as *mut u8 as *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`.
|
/// Return a mutable reference to the associated `Instance`.
|
||||||
|
#[allow(cast_ptr_alignment)]
|
||||||
pub unsafe fn instance(&mut self) -> &mut Instance {
|
pub unsafe fn instance(&mut self) -> &mut Instance {
|
||||||
&mut *((self as *mut VMContext as *mut u8).offset(-Instance::vmctx_offset())
|
&mut *((self as *mut Self as *mut u8).offset(-Instance::vmctx_offset()) as *mut Instance)
|
||||||
as *mut Instance)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
float_arithmetic,
|
clippy::float_arithmetic,
|
||||||
mut_mut,
|
clippy::mut_mut,
|
||||||
nonminimal_bool,
|
clippy::nonminimal_bool,
|
||||||
option_map_unwrap_or,
|
clippy::option_map_unwrap_or,
|
||||||
option_map_unwrap_or_else,
|
clippy::option_map_unwrap_or_else,
|
||||||
print_stdout,
|
clippy::print_stdout,
|
||||||
unicode_not_nfc,
|
clippy::unicode_not_nfc,
|
||||||
use_self
|
clippy::use_self
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,14 @@
|
|||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
float_arithmetic,
|
clippy::float_arithmetic,
|
||||||
mut_mut,
|
clippy::mut_mut,
|
||||||
nonminimal_bool,
|
clippy::nonminimal_bool,
|
||||||
option_map_unwrap_or,
|
clippy::option_map_unwrap_or,
|
||||||
option_map_unwrap_or_else,
|
clippy::option_map_unwrap_or_else,
|
||||||
print_stdout,
|
clippy::print_stdout,
|
||||||
unicode_not_nfc,
|
clippy::unicode_not_nfc,
|
||||||
use_self
|
clippy::use_self
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,13 @@
|
|||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
float_arithmetic,
|
clippy::float_arithmetic,
|
||||||
mut_mut,
|
clippy::mut_mut,
|
||||||
nonminimal_bool,
|
clippy::nonminimal_bool,
|
||||||
option_map_unwrap_or,
|
clippy::option_map_unwrap_or,
|
||||||
option_map_unwrap_or_else,
|
clippy::option_map_unwrap_or_else,
|
||||||
unicode_not_nfc,
|
clippy::unicode_not_nfc,
|
||||||
use_self
|
clippy::use_self
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
|||||||
@@ -19,13 +19,13 @@
|
|||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
float_arithmetic,
|
clippy::float_arithmetic,
|
||||||
mut_mut,
|
clippy::mut_mut,
|
||||||
nonminimal_bool,
|
clippy::nonminimal_bool,
|
||||||
option_map_unwrap_or,
|
clippy::option_map_unwrap_or,
|
||||||
option_map_unwrap_or_else,
|
clippy::option_map_unwrap_or_else,
|
||||||
unicode_not_nfc,
|
clippy::unicode_not_nfc,
|
||||||
use_self
|
clippy::use_self
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,13 @@
|
|||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
warn(
|
warn(
|
||||||
float_arithmetic,
|
clippy::float_arithmetic,
|
||||||
mut_mut,
|
clippy::mut_mut,
|
||||||
nonminimal_bool,
|
clippy::nonminimal_bool,
|
||||||
option_map_unwrap_or,
|
clippy::option_map_unwrap_or,
|
||||||
option_map_unwrap_or_else,
|
clippy::option_map_unwrap_or_else,
|
||||||
unicode_not_nfc,
|
clippy::unicode_not_nfc,
|
||||||
use_self
|
clippy::use_self
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user