Merge pull request #1854 from bugadani/str

embassy-{net, sync, time}: Use fmt::unwrap
This commit is contained in:
Dario Nieuwenhuis
2023-09-03 00:35:21 +02:00
committed by GitHub
16 changed files with 30 additions and 22 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();
})