diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:03:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:03:36 +0000 |
commit | 17d40c6057c88f4c432b0d7bac88e1b84cb7e67f (patch) | |
tree | 3f66c4a5918660bb8a758ab6cda5ff8ee4f6cdcd /vendor/fs-err/src/errors.rs | |
parent | Adding upstream version 1.64.0+dfsg1. (diff) | |
download | rustc-f7f0cc2a5d72e2c61c1f6900e70eec992bea4273.tar.xz rustc-f7f0cc2a5d72e2c61c1f6900e70eec992bea4273.zip |
Adding upstream version 1.65.0+dfsg1.upstream/1.65.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/fs-err/src/errors.rs')
-rw-r--r-- | vendor/fs-err/src/errors.rs | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/vendor/fs-err/src/errors.rs b/vendor/fs-err/src/errors.rs index 466d28f11..43bc4ba42 100644 --- a/vendor/fs-err/src/errors.rs +++ b/vendor/fs-err/src/errors.rs @@ -47,12 +47,15 @@ pub(crate) struct Error { }
impl Error {
- pub fn new(source: io::Error, kind: ErrorKind, path: impl Into<PathBuf>) -> io::Error {
- Self::_new(source, kind, path.into())
- }
-
- fn _new(source: io::Error, kind: ErrorKind, path: PathBuf) -> io::Error {
- io::Error::new(source.kind(), Self { kind, source, path })
+ pub fn build(source: io::Error, kind: ErrorKind, path: impl Into<PathBuf>) -> io::Error {
+ io::Error::new(
+ source.kind(),
+ Self {
+ kind,
+ source,
+ path: path.into(),
+ },
+ )
}
}
@@ -131,28 +134,19 @@ pub(crate) struct SourceDestError { }
impl SourceDestError {
- pub fn new(
+ pub fn build(
source: io::Error,
kind: SourceDestErrorKind,
from_path: impl Into<PathBuf>,
to_path: impl Into<PathBuf>,
) -> io::Error {
- Self::_new(source, kind, from_path.into(), to_path.into())
- }
-
- fn _new(
- source: io::Error,
- kind: SourceDestErrorKind,
- from_path: PathBuf,
- to_path: PathBuf,
- ) -> io::Error {
io::Error::new(
source.kind(),
Self {
kind,
source,
- from_path,
- to_path,
+ from_path: from_path.into(),
+ to_path: to_path.into(),
},
)
}
|