diff options
| author | Dániel Buga <[email protected]> | 2023-09-02 07:44:10 +0200 |
|---|---|---|
| committer | Dániel Buga <[email protected]> | 2023-09-02 08:39:52 +0200 |
| commit | 0c66636d003979c3aecff36c9e03e87f34147a94 (patch) | |
| tree | d79b1578cb559a40f0bfe8c2a1b33263cecc4364 /embassy-sync | |
| parent | 8339423a2f194d31f3f26d956f68dfcef46f8891 (diff) | |
Use fmt::unwrap
Diffstat (limited to 'embassy-sync')
| -rw-r--r-- | embassy-sync/src/channel.rs | 2 | ||||
| -rw-r--r-- | embassy-sync/src/mutex.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/embassy-sync/src/channel.rs b/embassy-sync/src/channel.rs index 62ea1307d..a512e0c41 100644 --- a/embassy-sync/src/channel.rs +++ b/embassy-sync/src/channel.rs | |||
| @@ -471,7 +471,7 @@ where | |||
| 471 | } | 471 | } |
| 472 | 472 | ||
| 473 | fn lock<R>(&self, f: impl FnOnce(&mut ChannelState<T, N>) -> R) -> R { | 473 | fn lock<R>(&self, f: impl FnOnce(&mut ChannelState<T, N>) -> R) -> R { |
| 474 | self.inner.lock(|rc| f(&mut *rc.borrow_mut())) | 474 | self.inner.lock(|rc| f(&mut *unwrap!(rc.try_borrow_mut()))) |
| 475 | } | 475 | } |
| 476 | 476 | ||
| 477 | fn try_receive_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryReceiveError> { | 477 | fn try_receive_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryReceiveError> { |
diff --git a/embassy-sync/src/mutex.rs b/embassy-sync/src/mutex.rs index fcf056d36..72459d660 100644 --- a/embassy-sync/src/mutex.rs +++ b/embassy-sync/src/mutex.rs | |||
| @@ -149,7 +149,7 @@ where | |||
| 149 | { | 149 | { |
| 150 | fn drop(&mut self) { | 150 | fn drop(&mut self) { |
| 151 | self.mutex.state.lock(|s| { | 151 | self.mutex.state.lock(|s| { |
| 152 | let mut s = s.borrow_mut(); | 152 | let mut s = unwrap!(s.try_borrow_mut()); |
| 153 | s.locked = false; | 153 | s.locked = false; |
| 154 | s.waker.wake(); | 154 | s.waker.wake(); |
| 155 | }) | 155 | }) |
