Skip to content

Commit 318ec09

Browse files
committed
Update JsString::try_from to use new dyn_ref
1 parent 301848f commit 318ec09

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

crates/js-sys/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3515,11 +3515,7 @@ impl JsString {
35153515
/// If this JS value is not an instance of a string then this returns
35163516
/// `None`.
35173517
pub fn try_from(val: &JsValue) -> Option<&JsString> {
3518-
if val.is_string() {
3519-
Some(unsafe { mem::transmute(val) })
3520-
} else {
3521-
None
3522-
}
3518+
val.dyn_ref()
35233519
}
35243520

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

0 commit comments

Comments
 (0)