Skip to content

Commit

Permalink
Remove FromRawFd/Handle implementations
Browse files Browse the repository at this point in the history
This is a breaking change, but I think it's justified for two reasons:

- It removes all unsafe code from this crate.
- FromRawFd is superseded by From<OwnedFd>

cc rust-secure-code/safety-dance#83

Signed-off-by: John Nunley <[email protected]>
  • Loading branch information
notgull committed Sep 26, 2023
1 parent c971597 commit a286c41
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
//! # std::io::Result::Ok(()) });
//! ```

#![forbid(unsafe_code)]
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)]
#![doc(
html_favicon_url = "https://raw.githubusercontent.com/smol-rs/smol/master/assets/images/logo_fullsize_transparent.png"
Expand Down Expand Up @@ -1070,20 +1071,6 @@ impl From<std::fs::File> for File {
}
}

#[cfg(unix)]
impl std::os::unix::io::FromRawFd for File {
unsafe fn from_raw_fd(raw: std::os::unix::io::RawFd) -> File {
File::from(std::fs::File::from_raw_fd(raw))
}
}

#[cfg(windows)]
impl std::os::windows::io::FromRawHandle for File {
unsafe fn from_raw_handle(raw: std::os::windows::io::RawHandle) -> File {
File::from(std::fs::File::from_raw_handle(raw))
}
}

#[cfg(unix)]
impl std::os::unix::io::AsRawFd for File {
fn as_raw_fd(&self) -> std::os::unix::io::RawFd {
Expand Down

0 comments on commit a286c41

Please sign in to comment.