Skip to content

Commit 11a6460

Browse files
Remove deprecated APIs (#66)
1 parent 27144b0 commit 11a6460

File tree

4 files changed

+10
-32
lines changed

4 files changed

+10
-32
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
* 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).
2020

21+
* Removed deprecated APIs: `File::from_options`, `tokio::symlink`
22+
2123
## 2.11.0
2224

2325
* 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))

src/file.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,6 @@ impl File {
5757
}
5858
}
5959

60-
/// Wrapper for [`OpenOptions::open`](https://doc.rust-lang.org/stable/std/fs/struct.OpenOptions.html#method.open).
61-
///
62-
/// This takes [`&std::fs::OpenOptions`](https://doc.rust-lang.org/stable/std/fs/struct.OpenOptions.html),
63-
/// not [`crate::OpenOptions`].
64-
#[deprecated = "use fs_err::OpenOptions::open instead"]
65-
pub fn from_options<P>(path: P, options: &fs::OpenOptions) -> Result<Self, io::Error>
66-
where
67-
P: Into<PathBuf>,
68-
{
69-
let path = path.into();
70-
match options.open(&path) {
71-
Ok(file) => Ok(File::from_parts(file, path)),
72-
Err(source) => Err(Error::build(source, ErrorKind::OpenFile, path)),
73-
}
74-
}
75-
7660
/// Attempts to sync all OS-internal metadata to disk.
7761
///
7862
/// Wrapper for [`File::sync_all`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.sync_all).

src/open_options.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
use std::{fs, io, path::PathBuf};
2+
3+
use crate::errors::{Error, ErrorKind};
4+
25
#[derive(Clone, Debug)]
36
/// Wrapper around [`std::fs::OpenOptions`](https://doc.rust-lang.org/std/fs/struct.OpenOptions.html)
47
pub struct OpenOptions(fs::OpenOptions);
@@ -67,12 +70,11 @@ impl OpenOptions {
6770
where
6871
P: Into<PathBuf>,
6972
{
70-
// We have to either duplicate the logic or call the deprecated method here.
71-
// We can't let the deprecated function call this method, because we can't construct
72-
// `&fs_err::OpenOptions` from `&fs::OpenOptions` without cloning
73-
// (although cloning would probably be cheap).
74-
#[allow(deprecated)]
75-
crate::File::from_options(path.into(), self.options())
73+
let path = path.into();
74+
match self.0.open(&path) {
75+
Ok(file) => Ok(crate::File::from_parts(file, path)),
76+
Err(source) => Err(Error::build(source, ErrorKind::OpenFile, path)),
77+
}
7678
}
7779
}
7880

src/tokio/mod.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,6 @@ pub async fn symlink(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> io::Result
198198
.map_err(|err| SourceDestError::build(err, SourceDestErrorKind::Symlink, src, dst))
199199
}
200200

201-
/// Creates a new directory symlink on the filesystem.
202-
///
203-
/// Wrapper for [`tokio::fs::symlink_dir`].
204-
#[cfg(windows)]
205-
#[cfg_attr(docsrs, doc(cfg(feature = "tokio")))]
206-
#[deprecated = "use fs_err::tokio::symlink_dir instead"]
207-
pub async fn symlink(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> io::Result<()> {
208-
symlink_dir(src, dst).await
209-
}
210-
211201
/// Creates a new directory symlink on the filesystem.
212202
///
213203
/// Wrapper for [`tokio::fs::symlink_dir`].

0 commit comments

Comments
 (0)