coffee-tools / coffee-tools/coffee

Investigate and Address Clippy Warning for `MutexGuard` Held Across Await Points

Open
#177 1 comment 0 reactions 1 assignee Assigned to @vincenzopalazzo View on GitHub
P-low
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.