diff --git a/src/lib.rs b/src/lib.rs index e9b1a24cbd..91c10eeb5b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -434,7 +434,6 @@ where /// Nem attempt use core::cell::RefCell; -use core::cell::RefMut; //use core::borrow::BorrowMut; /// A resource @@ -556,17 +555,17 @@ impl ResRef> { basepri_max::write(::hw()); barrier!(); - let r: &RefCell = &*self.data.get(); - let rr: RefCell = *r; - let mut rm: RefMut = rr.borrow_mut(); - let mut t: T = *rm; - let ret = f(&mut t, &C { _marker: PhantomData }); + let a = &*self.data.get(); + let mut am = a.borrow_mut(); + let ret = f(&mut am, &C { _marker: PhantomData }); barrier!(); basepri::write(old_basepri); ret } else { - panic!(""); + let a = &*self.data.get(); + let mut am = a.borrow_mut(); + f(&mut am, &C { _marker: PhantomData }) } } }