fix clippy warnings

This commit is contained in:
vms 2020-07-25 11:10:50 +03:00
parent 6d42a84ba4
commit 053056c1eb
3 changed files with 12 additions and 19 deletions

View File

@ -15,7 +15,7 @@ executable_instruction!(
InstructionError::new(
instruction,
InstructionErrorKind::LocalOrImportIsMissing {
function_index: function_index,
function_index,
},
)
})?;
@ -38,7 +38,7 @@ executable_instruction!(
return Err(InstructionError::new(
instruction,
InstructionErrorKind::LocalOrImportSignatureMismatch {
function_index: function_index,
function_index,
expected: (local_or_import.inputs().to_vec(), vec![]),
received: (input_types, vec![]),
},
@ -49,7 +49,7 @@ executable_instruction!(
InstructionError::new(
instruction,
InstructionErrorKind::LocalOrImportCall {
function_index: function_index,
function_index,
},
)
})?;

View File

@ -165,11 +165,7 @@ where
InterfaceType::F32 => {
values.push_front(InterfaceValue::F32(value as _));
}
InterfaceType::F64 => {
unsafe {
values.push_front(InterfaceValue::F64(std::mem::transmute::<u64, f64>(value)))
};
}
InterfaceType::F64 => values.push_front(InterfaceValue::F64(f64::from_bits(value))),
InterfaceType::Anyref => {}
InterfaceType::String => {
let offset = value;
@ -305,19 +301,16 @@ where
InterfaceValue::I32(value) => result.push(value as _),
InterfaceValue::I64(value) => result.push(value as _),
InterfaceValue::F32(value) => result.push(value as _),
InterfaceValue::F64(value) => {
result.push(unsafe { std::mem::transmute::<f64, u64>(value) })
}
InterfaceValue::F64(value) => result.push(value.to_bits()),
InterfaceValue::String(value) => {
let string_pointer =
write_to_instance_mem(instance, instruction.clone(), value.as_bytes())?;
write_to_instance_mem(instance, instruction, value.as_bytes())?;
result.push(string_pointer as _);
result.push(value.len() as _);
}
InterfaceValue::ByteArray(value) => {
let byte_array_pointer =
write_to_instance_mem(instance, instruction.clone(), &value)?;
let byte_array_pointer = write_to_instance_mem(instance, instruction, &value)?;
result.push(byte_array_pointer as _);
result.push(value.len() as _);
}
@ -333,7 +326,7 @@ where
}
let result = safe_transmute::transmute_to_bytes::<u64>(&result);
let result_pointer = write_to_instance_mem(instance, instruction.clone(), &result)?;
let result_pointer = write_to_instance_mem(instance, instruction, &result)?;
Ok((result_pointer, result.len() as _))
}

View File

@ -53,7 +53,7 @@ where
MemoryView: wasm::structures::MemoryView,
Instance: wasm::structures::Instance<Export, LocalImport, Memory, MemoryView>,
{
let mem_pointer = allocate(instance, instruction.clone(), bytes.len() as _)?;
let mem_pointer = allocate(instance, instruction, bytes.len() as _)?;
let memory_index: u32 = 0;
let memory_view = instance
@ -88,7 +88,7 @@ where
let values = call_core(
instance,
ALLOCATE_FUNC_INDEX,
instruction.clone(),
instruction,
vec![InterfaceValue::I32(size)],
)?;
if values.len() != 1 {
@ -101,7 +101,7 @@ where
},
));
}
to_native::<i32>(&values[0], instruction.clone())
to_native::<i32>(&values[0], instruction)
}
pub(super) fn deallocate<'instance, Instance, Export, LocalImport, Memory, MemoryView>(
@ -120,7 +120,7 @@ where
let _ = call_core(
instance,
DEALLOCATE_FUNC_INDEX,
instruction.clone(),
instruction,
vec![InterfaceValue::I32(mem_ptr), InterfaceValue::I32(size)],
)?;