Skip to content

Commit ba1f67d

Browse files
committed
Remove some unnecessary unsafe in js-sys
1 parent df8da56 commit ba1f67d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/js-sys/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ impl Function {
898898
/// `None`.
899899
pub fn try_from(val: &JsValue) -> Option<&Function> {
900900
if val.is_function() {
901-
Some(unsafe { mem::transmute(val) })
901+
Some(val.unchecked_ref())
902902
} else {
903903
None
904904
}
@@ -2153,7 +2153,7 @@ impl Object {
21532153
/// `None`.
21542154
pub fn try_from(val: &JsValue) -> Option<&Object> {
21552155
if val.is_object() {
2156-
Some(unsafe { mem::transmute(val) })
2156+
Some(val.unchecked_ref())
21572157
} else {
21582158
None
21592159
}
@@ -3588,7 +3588,7 @@ impl JsString {
35883588
/// `None`.
35893589
pub fn try_from(val: &JsValue) -> Option<&JsString> {
35903590
if val.is_string() {
3591-
Some(unsafe { mem::transmute(val) })
3591+
Some(val.unchecked_ref())
35923592
} else {
35933593
None
35943594
}

0 commit comments

Comments
 (0)