The rustix::io::close explain why it does not return theoretically possible errors, but in our code we already return IO errors from function which drops OwnedFd, so we can "bubble" potential errors basically for free. Doing so would remove potential panic path (unreachable in practice, but still present) and potential questions during code review.
I suggest to add inherent OwnedFd::try_close(self) -> Result<()> method for cases like this.
The
rustix::io::closeexplain why it does not return theoretically possible errors, but in our code we already return IO errors from function which dropsOwnedFd, so we can "bubble" potential errors basically for free. Doing so would remove potential panic path (unreachable in practice, but still present) and potential questions during code review.I suggest to add inherent
OwnedFd::try_close(self) -> Result<()>method for cases like this.