Skip to content

Commit

Permalink
Remove io_safety feature flag (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhickman authored Oct 23, 2024
1 parent 1a26274 commit 27144b0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ jobs:
args: --tests -- -D warnings
if: matrix.rust_version == 'stable'

- name: cargo check --features "io_safety"
uses: actions-rs/cargo@v1
with:
command: check
args: --features io_safety
if: ${{ matrix.rust_version == 'stable' || matrix.rust_version == 'beta' }}

- name: cargo check --features tokio
uses: actions-rs/cargo@v1
with:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

Note that the original error is no longer exposed though [`Error::source()`](https://doc.rust-lang.org/stable/std/error/trait.Error.html#method.source) by default. If you need access to it, you can restore the previous behaviour with the `expose_original_error` feature flag.

* The `io_safety` feature flag has been removed, and this functionality is now always enabled on Rust versions which support it (1.63.0 and greater).

## 2.11.0

* Added the first line of the standard library documentation to each function's rustdocs, to make them more useful in IDEs ([#50](https://github.com/andrewhickman/fs-err/issues/45))
Expand Down
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ autocfg = "1"
serde_json = "1.0.64"

[features]
# Adds I/O safety traits, introduced in Rust 1.63
io_safety = []

# Allow custom formatting of the error source
#
# When enabled errors emit `std::error::Error::source()` as Some (default is `None`) and
Expand Down
8 changes: 2 additions & 6 deletions src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,16 @@ mod unix {
}
}

#[cfg(feature = "io_safety")]
#[cfg(rustc_1_63)]
mod io_safety {
use std::os::unix::io::{AsFd, BorrowedFd, OwnedFd};

#[cfg_attr(docsrs, doc(cfg(feature = "io_safety")))]
impl AsFd for crate::File {
fn as_fd(&self) -> BorrowedFd<'_> {
self.file().as_fd()
}
}

#[cfg_attr(docsrs, doc(cfg(feature = "io_safety")))]
impl From<crate::File> for OwnedFd {
fn from(file: crate::File) -> Self {
file.into_parts().0.into()
Expand Down Expand Up @@ -363,18 +361,16 @@ mod windows {
}
}

#[cfg(feature = "io_safety")]
#[cfg(rustc_1_63)]
mod io_safety {
use std::os::windows::io::{AsHandle, BorrowedHandle, OwnedHandle};

#[cfg_attr(docsrs, doc(cfg(feature = "io_safety")))]
impl AsHandle for crate::File {
fn as_handle(&self) -> BorrowedHandle<'_> {
self.file().as_handle()
}
}

#[cfg_attr(docsrs, doc(cfg(feature = "io_safety")))]
impl From<crate::File> for OwnedHandle {
fn from(file: crate::File) -> Self {
file.into_parts().0.into()
Expand Down

0 comments on commit 27144b0

Please sign in to comment.