A bunch more work on replacing every potential panic with results
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
/// The WASM module handles loading dynamic scripts through WebAssembly.
|
||||
#[cfg(feature = "wasm")]
|
||||
// FIXME: allow these for now until we have a good result interface defined.
|
||||
#[allow(clippy::unwrap_used)]
|
||||
#[allow(clippy::expect_used)]
|
||||
#[allow(clippy::indexing_slicing)]
|
||||
#[allow(clippy::string_slice)]
|
||||
#[allow(clippy::exit)]
|
||||
#[allow(clippy::panic)]
|
||||
pub mod wasm;
|
||||
|
||||
@@ -78,7 +78,7 @@ register! {
|
||||
let c_name = CStr::from_ptr(env.data().data().get_raw_pointer(name_ptr));
|
||||
let script = side.value_func(&env).unwrap().add_volatile_script(&c_name.as_ref().into()).unwrap();
|
||||
if let Some(script) = script {
|
||||
let script = script.get_as::<WebAssemblyScript>();
|
||||
let script = script.get_as::<WebAssemblyScript>().unwrap();
|
||||
script.get_wasm_pointer()
|
||||
} else {
|
||||
0
|
||||
@@ -101,7 +101,7 @@ register! {
|
||||
|
||||
if let Some(script) = script {
|
||||
let script = side.add_volatile_script_with_script(script);
|
||||
let s = script.as_ref().unwrap().as_ref().unwrap().get_as::<WebAssemblyScript>();
|
||||
let s = script.as_ref().unwrap().as_ref().unwrap().get_as::<WebAssemblyScript>().unwrap();
|
||||
s.get_wasm_pointer()
|
||||
} else {
|
||||
0
|
||||
@@ -129,7 +129,7 @@ register! {
|
||||
let c_name = CStr::from_ptr(env.data().data().get_raw_pointer(name_ptr));
|
||||
let script = side.value_func(&env).unwrap().get_volatile_script(&c_name.as_ref().into());
|
||||
if let Some(script) = script {
|
||||
let script = script.get_as::<WebAssemblyScript>();
|
||||
let script = script.get_as::<WebAssemblyScript>().unwrap();
|
||||
script.get_wasm_pointer()
|
||||
} else {
|
||||
0
|
||||
@@ -144,7 +144,7 @@ register! {
|
||||
) {
|
||||
unsafe {
|
||||
let c_name = CStr::from_ptr(env.data().data().get_raw_pointer(name_ptr));
|
||||
side.value_func(&env).unwrap().remove_volatile_script(&c_name.as_ref().into());
|
||||
side.value_func(&env).unwrap().remove_volatile_script(&c_name.as_ref().into()).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -413,7 +413,7 @@ register! {
|
||||
let c_name = CStr::from_ptr(env.data().data().get_raw_pointer(name_ptr));
|
||||
let script = pokemon.value_func(&env).unwrap().add_volatile_script(&c_name.as_ref().into()).unwrap();
|
||||
if let Some(script) = script {
|
||||
let script = script.get_as::<WebAssemblyScript>();
|
||||
let script = script.get_as::<WebAssemblyScript>().unwrap();
|
||||
script.get_wasm_pointer()
|
||||
} else {
|
||||
0
|
||||
@@ -436,7 +436,7 @@ register! {
|
||||
|
||||
if let Some(script) = script {
|
||||
let script = pokemon.add_volatile_script_with_script(script);
|
||||
let s = script.as_ref().unwrap().as_ref().unwrap().get_as::<WebAssemblyScript>();
|
||||
let s = script.as_ref().unwrap().as_ref().unwrap().get_as::<WebAssemblyScript>().unwrap();
|
||||
s.get_wasm_pointer()
|
||||
} else {
|
||||
0
|
||||
@@ -464,7 +464,7 @@ register! {
|
||||
let c_name = CStr::from_ptr(env.data().data().get_raw_pointer(name_ptr));
|
||||
let script = pokemon.value_func(&env).unwrap().get_volatile_script(&c_name.as_ref().into());
|
||||
if let Some(script) = script {
|
||||
let script = script.get_as::<WebAssemblyScript>();
|
||||
let script = script.get_as::<WebAssemblyScript>().unwrap();
|
||||
script.get_wasm_pointer()
|
||||
} else {
|
||||
0
|
||||
@@ -479,7 +479,7 @@ register! {
|
||||
) {
|
||||
unsafe {
|
||||
let c_name = CStr::from_ptr(env.data().data().get_raw_pointer(name_ptr));
|
||||
pokemon.value_func(&env).unwrap().remove_volatile_script(&c_name.as_ref().into());
|
||||
pokemon.value_func(&env).unwrap().remove_volatile_script(&c_name.as_ref().into()).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// allow these for now until we have a good result interface defined.
|
||||
#[allow(clippy::unwrap_used)]
|
||||
#[allow(clippy::expect_used)]
|
||||
/// The export registry module deals with registering all functions we require in WebAssembly.
|
||||
mod export_registry;
|
||||
/// A hacky extern ref implementation to ensure the client does not do things it is not allowed to do.
|
||||
|
||||
Reference in New Issue
Block a user