Skip to content

Add OwnedFd::try_close method? #1084

@newpavlov

Description

@newpavlov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions