Skip to content

Commit

Permalink
Remove some unnecessary unsafe in js-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Apr 12, 2019
1 parent df8da56 commit ba1f67d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/js-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit ba1f67d

Please sign in to comment.