Fix minor issues

pull/1036/head
jtnunley 2 years ago
parent 27f26ea430
commit dc7bb8e97d
No known key found for this signature in database
GPG Key ID: 42B2FA4582BB1EC9

@ -417,6 +417,15 @@ impl From<std::fs::File> for File {
cfg_unix! {
use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
impl File {
fn into_std_file(self) -> std::fs::File {
let file = self.file.clone();
drop(self);
Arc::try_unwrap(file)
.expect(ARC_TRY_UNWRAP_EXPECT)
}
}
impl AsRawFd for File {
fn as_raw_fd(&self) -> RawFd {
self.file.as_raw_fd()
@ -431,11 +440,7 @@ cfg_unix! {
impl IntoRawFd for File {
fn into_raw_fd(self) -> RawFd {
let file = self.file.clone();
drop(self);
Arc::try_unwrap(file)
.expect(ARC_TRY_UNWRAP_EXPECT)
.into_raw_fd()
self.into_std_file().into_raw_fd()
}
}
@ -456,11 +461,7 @@ cfg_unix! {
impl From<File> for OwnedFd {
fn from(val: File) -> OwnedFd {
let file = val.file.clone();
drop(val);
Arc::try_unwrap(file)
.expect(ARC_TRY_UNWRAP_EXPECT)
.into()
self.into_std_file()
}
}
}

Loading…
Cancel
Save