DEV Community

Discussion on: Async, refactoring and fewer bugs: Rust block expressions to the rescue

Collapse
 
updogliu profile image
Zihan Liu

Will let a = *a.read().await; do?

Collapse
 
igorpetruk profile image
Igor Petruk

I'd say so, yes. Probably block expression helps more if you need to do a few operations on the unlocked value while it is still borrowed. Or if you would like to combine multiple unlocks, but you want to limit the scope for no longer than necessary.