Use .into() to convert TrapKind into Trap
This commit is contained in:
parent
2c2cb72078
commit
2b880b1e18
|
@ -29,7 +29,7 @@ impl<'a> RuntimeArgs<'a> {
|
|||
/// Returns `Err` if this list has not enough arguments.
|
||||
pub fn nth_value_checked(&self, idx: usize) -> Result<RuntimeValue, Trap> {
|
||||
if self.0.len() <= idx {
|
||||
return Err(Trap::new(TrapKind::UnexpectedSignature));
|
||||
return Err(TrapKind::UnexpectedSignature.into());
|
||||
}
|
||||
Ok(self.0[idx])
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ impl Externals for NopExternals {
|
|||
_index: usize,
|
||||
_args: RuntimeArgs,
|
||||
) -> Result<Option<RuntimeValue>, Trap> {
|
||||
Err(Trap::new(TrapKind::Unreachable))
|
||||
Err(TrapKind::Unreachable.into())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ impl Externals for TestHost {
|
|||
ERR_FUNC_INDEX => {
|
||||
let error_code: u32 = args.nth(0);
|
||||
let error = HostErrorWithCode { error_code };
|
||||
Err(Trap::new(TrapKind::Host(Box::new(error))))
|
||||
Err(TrapKind::Host(Box::new(error)).into())
|
||||
}
|
||||
INC_MEM_FUNC_INDEX => {
|
||||
let ptr: u32 = args.nth(0);
|
||||
|
@ -131,7 +131,7 @@ impl Externals for TestHost {
|
|||
.expect("expected to be Some");
|
||||
|
||||
if val.value_type() != result.value_type() {
|
||||
return Err(Trap::new(TrapKind::Host(Box::new(HostErrorWithCode { error_code: 123 }))));
|
||||
return Err(TrapKind::Host(Box::new(HostErrorWithCode { error_code: 123 })).into());
|
||||
}
|
||||
Ok(Some(result))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue