From ea4b5e4df0fc5f67539347066c9cc502ceada28a Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 25 Mar 2017 18:01:36 +0300 Subject: [PATCH] Remove unnecessary transmute in generate_mask() rand::Rand has impl Rand for [T; 16] where T: Rand so we don't need to simulate it ourselves. --- src/protocol/frame/frame.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol/frame/frame.rs b/src/protocol/frame/frame.rs index 3992bc5..3719e25 100644 --- a/src/protocol/frame/frame.rs +++ b/src/protocol/frame/frame.rs @@ -22,7 +22,7 @@ fn apply_mask(buf: &mut [u8], mask: &[u8; 4]) { #[inline] fn generate_mask() -> [u8; 4] { - unsafe { transmute(rand::random::()) } + rand::random() } /// A struct representing a WebSocket frame.