Use fmt::unwrap

This commit is contained in:
Dániel Buga
2023-09-02 07:44:10 +02:00
parent 8339423a2f
commit 0c66636d00
6 changed files with 14 additions and 14 deletions

View File

@ -471,7 +471,7 @@ where
}
fn lock<R>(&self, f: impl FnOnce(&mut ChannelState<T, N>) -> R) -> R {
self.inner.lock(|rc| f(&mut *rc.borrow_mut()))
self.inner.lock(|rc| f(&mut *unwrap!(rc.try_borrow_mut())))
}
fn try_receive_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryReceiveError> {

View File

@ -149,7 +149,7 @@ where
{
fn drop(&mut self) {
self.mutex.state.lock(|s| {
let mut s = s.borrow_mut();
let mut s = unwrap!(s.try_borrow_mut());
s.locked = false;
s.waker.wake();
})