Skip to content

Investigate and Address Clippy Warning for MutexGuard Held Across Await Points #177

@tareknaser

Description

@tareknaser

Description

Currently, coffee_plugin crate is producing two similar clippy warnings. The warning message is as follows:

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.

Metadata

Metadata

Labels

P-lowLow priority issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions