Open omarandlorraine opened 1 year ago
I like this idea! Although there are some exceptions we should probably make, such as with Mutex
. Using an async Mutex
only makes sense when the guard is held across an await point. In most other cases, it's totally fine to use the Mutex
from the standard library (or parking_lot), even in an async context
Well since I have wrote a simple but similar one
in the past for my own fork of clippy, I'll take the chance make it official, lol
@rustbot claim
This looks like a duplicate (with refinements, suggesting what use instead) of #4377.
What it does
A lint which checks for blocking functions inside an async block.
One I know of (and the cause of a bug I ran into today) is
std::thread::sleep
, but there are others. (file operations, networking, ...). If such a function has an async counterpart, then the user could be warned of this fact.Lint Name
unwise-block
Category
suspicious
Advantage
Drawbacks
Example
Could be written as:
Note the different way to sleep in the
rx
function.