Skip to content

Commit

Permalink
Update JsString::try_from to use new dyn_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed Apr 11, 2019
1 parent 301848f commit 318ec09
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions crates/js-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3515,11 +3515,7 @@ impl JsString {
/// If this JS value is not an instance of a string then this returns
/// `None`.
pub fn try_from(val: &JsValue) -> Option<&JsString> {
if val.is_string() {
Some(unsafe { mem::transmute(val) })
} else {
None
}
val.dyn_ref()
}

/// Returns whether this string is a valid UTF-16 string.
Expand Down

0 comments on commit 318ec09

Please sign in to comment.