{
let guard = MyMutex.lock();
/* some critical functions*/
drop(guard);
}
Is this piece of codes in good style with respect to Rust programming?
Otherwise, can it be improved that we don't need to explicitly call the drop function.
Explicitly dropping guards is definitely good style. In some cases it's also ok to drop them with scope, but I think it's always good style to explicitly drop them.