MutexGuard poisons itself if a panic happens while it is held. I fully support this for safety. Likewise, fs::File should be safe, particularly for writes.
- there should be a .close() that returns a Result, and normal lint warnings should ensure it’s checked with a try! (or equivalent)
- if somone forgets to explicitly call .close(), and the implicit close() called from drop fails, and no existing panic is active, it should panic.
Just to be clear: http://man7.org/linux/man-pages/man2/close.2.html
Not checking the return value of close() is a common but nevertheless serious programming error. It is quite possible that errors on a previous write(2) operation are first reported at the final close(). Not checking the return value when closing the file may lead to silent loss of data. This can especially be observed with NFS and with disk quota.