mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
Remove some unnecessary unsafe
in js-sys
This commit is contained in:
parent
df8da56a6c
commit
ba1f67d854
@ -898,7 +898,7 @@ impl Function {
|
||||
/// `None`.
|
||||
pub fn try_from(val: &JsValue) -> Option<&Function> {
|
||||
if val.is_function() {
|
||||
Some(unsafe { mem::transmute(val) })
|
||||
Some(val.unchecked_ref())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@ -2153,7 +2153,7 @@ impl Object {
|
||||
/// `None`.
|
||||
pub fn try_from(val: &JsValue) -> Option<&Object> {
|
||||
if val.is_object() {
|
||||
Some(unsafe { mem::transmute(val) })
|
||||
Some(val.unchecked_ref())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@ -3588,7 +3588,7 @@ impl JsString {
|
||||
/// `None`.
|
||||
pub fn try_from(val: &JsValue) -> Option<&JsString> {
|
||||
if val.is_string() {
|
||||
Some(unsafe { mem::transmute(val) })
|
||||
Some(val.unchecked_ref())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user