From ebd717d715e2868e748304d51e9f8fddb8333ee8 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Wed, 20 Jun 2018 09:51:01 +0200 Subject: [PATCH] Remove unsafe code from SharedHttpInnerMessage --- src/server/helpers.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/server/helpers.rs b/src/server/helpers.rs index 939785f4c..8adbad439 100644 --- a/src/server/helpers.rs +++ b/src/server/helpers.rs @@ -76,8 +76,7 @@ impl SharedHttpInnerMessage { #[inline] pub fn get_mut(&mut self) -> &mut HttpInnerMessage { - let r: &HttpInnerMessage = self.0.as_ref().unwrap().as_ref(); - unsafe { &mut *(r as *const _ as *mut _) } + Rc::get_mut(self.0.as_mut().unwrap()).expect("cannot get mutable reference while object is immutably borrowed") } #[inline]