Is this piece of codes in good style?

{
    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.

Thank you guys for replying!

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.

I see, thans for your explanation

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.