diff options
Diffstat (limited to 'vendor/walkdir/src')
-rw-r--r-- | vendor/walkdir/src/dent.rs | 37 | ||||
-rw-r--r-- | vendor/walkdir/src/error.rs | 11 | ||||
-rw-r--r-- | vendor/walkdir/src/lib.rs | 6 |
3 files changed, 14 insertions, 40 deletions
diff --git a/vendor/walkdir/src/dent.rs b/vendor/walkdir/src/dent.rs index a28ed3dea..adf54f739 100644 --- a/vendor/walkdir/src/dent.rs +++ b/vendor/walkdir/src/dent.rs @@ -177,18 +177,6 @@ impl DirEntry { } /// Returns true if and only if this entry points to a directory. - /// - /// This works around a bug in Rust's standard library: - /// https://github.com/rust-lang/rust/issues/46484 - #[cfg(windows)] - pub(crate) fn is_dir(&self) -> bool { - use std::os::windows::fs::MetadataExt; - use winapi::um::winnt::FILE_ATTRIBUTE_DIRECTORY; - self.metadata.file_attributes() & FILE_ATTRIBUTE_DIRECTORY != 0 - } - - /// Returns true if and only if this entry points to a directory. - #[cfg(not(windows))] pub(crate) fn is_dir(&self) -> bool { self.ty.is_dir() } @@ -205,13 +193,7 @@ impl DirEntry { let md = ent .metadata() .map_err(|err| Error::from_path(depth, path.clone(), err))?; - Ok(DirEntry { - path: path, - ty: ty, - follow_link: false, - depth: depth, - metadata: md, - }) + Ok(DirEntry { path, ty, follow_link: false, depth, metadata: md }) } #[cfg(unix)] @@ -226,9 +208,9 @@ impl DirEntry { .map_err(|err| Error::from_path(depth, ent.path(), err))?; Ok(DirEntry { path: ent.path(), - ty: ty, + ty, follow_link: false, - depth: depth, + depth, ino: ent.ino(), }) } @@ -241,12 +223,7 @@ impl DirEntry { let ty = ent .file_type() .map_err(|err| Error::from_path(depth, ent.path(), err))?; - Ok(DirEntry { - path: ent.path(), - ty: ty, - follow_link: false, - depth: depth, - }) + Ok(DirEntry { path: ent.path(), ty, follow_link: false, depth }) } #[cfg(windows)] @@ -266,7 +243,7 @@ impl DirEntry { path: pb, ty: md.file_type(), follow_link: follow, - depth: depth, + depth, metadata: md, }) } @@ -290,7 +267,7 @@ impl DirEntry { path: pb, ty: md.file_type(), follow_link: follow, - depth: depth, + depth, ino: md.ino(), }) } @@ -312,7 +289,7 @@ impl DirEntry { path: pb, ty: md.file_type(), follow_link: follow, - depth: depth, + depth, }) } } diff --git a/vendor/walkdir/src/error.rs b/vendor/walkdir/src/error.rs index 9e25a075e..3342d9b75 100644 --- a/vendor/walkdir/src/error.rs +++ b/vendor/walkdir/src/error.rs @@ -164,10 +164,7 @@ impl Error { pb: PathBuf, err: io::Error, ) -> Self { - Error { - depth: depth, - inner: ErrorInner::Io { path: Some(pb), err: err }, - } + Error { depth, inner: ErrorInner::Io { path: Some(pb), err } } } pub(crate) fn from_entry(dent: &DirEntry, err: io::Error) -> Self { @@ -175,13 +172,13 @@ impl Error { depth: dent.depth(), inner: ErrorInner::Io { path: Some(dent.path().to_path_buf()), - err: err, + err, }, } } pub(crate) fn from_io(depth: usize, err: io::Error) -> Self { - Error { depth: depth, inner: ErrorInner::Io { path: None, err: err } } + Error { depth, inner: ErrorInner::Io { path: None, err } } } pub(crate) fn from_loop( @@ -190,7 +187,7 @@ impl Error { child: &Path, ) -> Self { Error { - depth: depth, + depth, inner: ErrorInner::Loop { ancestor: ancestor.to_path_buf(), child: child.to_path_buf(), diff --git a/vendor/walkdir/src/lib.rs b/vendor/walkdir/src/lib.rs index 929c5655e..4d41515df 100644 --- a/vendor/walkdir/src/lib.rs +++ b/vendor/walkdir/src/lib.rs @@ -601,7 +601,7 @@ impl Ancestor { #[cfg(windows)] fn new(dent: &DirEntry) -> io::Result<Ancestor> { let handle = Handle::from_path(dent.path())?; - Ok(Ancestor { path: dent.path().to_path_buf(), handle: handle }) + Ok(Ancestor { path: dent.path().to_path_buf(), handle }) } /// Create a new ancestor from the given directory path. @@ -811,7 +811,7 @@ impl IntoIter { where P: FnMut(&DirEntry) -> bool, { - FilterEntry { it: self, predicate: predicate } + FilterEntry { it: self, predicate } } fn handle_entry( @@ -1109,7 +1109,7 @@ where /// [`min_depth`]: struct.WalkDir.html#method.min_depth /// [`max_depth`]: struct.WalkDir.html#method.max_depth pub fn filter_entry(self, predicate: P) -> FilterEntry<Self, P> { - FilterEntry { it: self, predicate: predicate } + FilterEntry { it: self, predicate } } /// Skips the current directory. |