coffee-tools / coffee-tools/coffee
Investigate and Address Clippy Warning for `MutexGuard` Held Across Await Points
- Dominant language
- Rust
- Stars
- 11
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
# Description
Currently, `coffee_plugin` crate is producing two similar clippy warnings. The warning message is as follows:
```bash
warning: this `MutexGuard` is held across an `await` point
--> coffee_plugin/src/plugin/state.rs:45:9
|
45 | / self.coffee()
46 | | .lock()
47 | | .unwrap()
| |_____________________^
|
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
note: these are all the `await` points this lock is held through
--> coffee_plugin/src/plugin/state.rs:45:9
|
45 | / self.coffee()
46 | | .lock()
47 | | .unwrap()
48 | | .setup(&self.args.clone().unwrap().conf)
49 | | .await?;
| |____________________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock
```
# Goal
The aim of this issue is to resolve the clippy warnings in the `coffee_plugin` crate. Specifically, we need to address the warning about `MutexGuard` being held across an `await` point.
# Proposed Solution
To fix these warnings, we will need to make the code clippy compliant by either using an async-aware `Mutex` type (`tokio`) or ensuring that the `MutexGuard` is dropped before invoking the `await` function.
> If you encounter any issues or have any questions related to this task, please don't hesitate to open a discussion about it or leave a comment on the issue.
Contributor guide
Assessment
This issue has not been assessed yet.