mirror of
https://github.com/fluencelabs/interface-types
synced 2024-12-04 15:20:20 +00:00
fix clippy warnings
This commit is contained in:
parent
6d42a84ba4
commit
053056c1eb
@ -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,
|
||||
},
|
||||
)
|
||||
})?;
|
||||
|
@ -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 _))
|
||||
}
|
||||
|
@ -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)],
|
||||
)?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user