Skip to content

Commit

Permalink
fix various IDE warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Dec 15, 2022
1 parent 2d1b2fb commit cc0009f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
12 changes: 6 additions & 6 deletions src/core/dir_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{ClientState, Error, ReadDirSpec, Result};
/// Representation of a file or directory.
///
/// This representation does not wrap a `std::fs::DirEntry`. Instead it copies
/// `file_name`, `file_type`, and optionaly `metadata` out of the underlying
/// `file_name`, `file_type`, and optionally `metadata` out of the underlying
/// `std::fs::DirEntry`. This allows it to quickly drop the underlying file
/// descriptor.
pub struct DirEntry<C: ClientState> {
Expand Down Expand Up @@ -37,7 +37,7 @@ pub struct DirEntry<C: ClientState> {
pub read_children_error: Option<Error>,
// True if [`follow_links`] is `true` AND was created from a symlink path.
follow_link: bool,
// Origins of synlinks followed to get to this entry.
// Origins of symlinks followed to get to this entry.
follow_link_ancestors: Arc<Vec<Arc<Path>>>,
}

Expand Down Expand Up @@ -114,7 +114,7 @@ impl<C: ClientState> DirEntry<C> {
/// This never makes any system calls.
///
/// [`follow_links`]: struct.WalkDir.html#method.follow_links
pub fn file_type(&self) -> fs::FileType {
pub fn file_type(&self) -> FileType {
self.file_type
}

Expand All @@ -129,8 +129,8 @@ impl<C: ClientState> DirEntry<C> {
/// Returns the depth at which this entry was created relative to the root.
///
/// The smallest depth is `0` and always corresponds to the path given
/// to the `new` function on `WalkDir`. Its direct descendents have depth
/// `1`, and their descendents have depth `2`, and so on.
/// to the `new` function on `WalkDir`. Its direct descendants have depth
/// `1`, and their descendants have depth `2`, and so on.
pub fn depth(&self) -> usize {
self.depth
}
Expand Down Expand Up @@ -212,7 +212,7 @@ impl<C: ClientState> DirEntry<C> {
let dir_entry = DirEntry::from_path(self.depth, &path, true, origins)?;

if dir_entry.file_type.is_dir() {
let target = std::fs::read_link(&path).unwrap();
let target = fs::read_link(&path).unwrap();
for ancestor in self.follow_link_ancestors.iter().rev() {
if target.as_path() == ancestor.as_ref() {
return Err(Error::from_loop(
Expand Down
2 changes: 1 addition & 1 deletion src/core/dir_entry_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::Result;
/// Yields entries from recursive traversal of filesystem.
pub struct DirEntryIter<C: ClientState> {
min_depth: usize,
// iterator yeilding next ReadDir results when needed
// iterator yielding next ReadDir results when needed
read_dir_iter: Peekable<ReadDirIter<C>>,
// stack of ReadDir results, track location in filesystem traversal
read_dir_results_stack: Vec<vec::IntoIter<Result<DirEntry<C>>>>,
Expand Down
18 changes: 9 additions & 9 deletions src/core/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ impl Error {
/// Returns the depth at which this error occurred relative to the root.
///
/// The smallest depth is `0` and always corresponds to the path given to
/// the [`new`] function on [`WalkDir`]. Its direct descendents have depth
/// `1`, and their descendents have depth `2`, and so on.
/// the [`new`] function on [`WalkDir`]. Its direct descendants have depth
/// `1`, and their descendants have depth `2`, and so on.
///
/// [`new`]: struct.WalkDir.html#method.new
/// [`WalkDir`]: struct.WalkDir.html
Expand Down Expand Up @@ -207,6 +207,13 @@ impl Error {
}

impl error::Error for Error {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match self.inner {
ErrorInner::Io { ref err, .. } => Some(err),
ErrorInner::Loop { .. } => None,
}
}

#[allow(deprecated)]
fn description(&self) -> &str {
match self.inner {
Expand All @@ -218,13 +225,6 @@ impl error::Error for Error {
fn cause(&self) -> Option<&dyn error::Error> {
self.source()
}

fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match self.inner {
ErrorInner::Io { ref err, .. } => Some(err),
ErrorInner::Loop { .. } => None,
}
}
}

impl fmt::Display for Error {
Expand Down
4 changes: 2 additions & 2 deletions src/core/ordered_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl<T> OrderedQueue<T>
where
T: Send,
{
pub fn push(&self, ordered: Ordered<T>) -> std::result::Result<(), SendError<Ordered<T>>> {
pub fn push(&self, ordered: Ordered<T>) -> Result<(), SendError<Ordered<T>>> {
self.pending_count.fetch_add(1, AtomicOrdering::SeqCst);
self.sender.send(ordered)
}
Expand Down Expand Up @@ -124,7 +124,7 @@ where

fn try_next_strict(&mut self) -> Result<Ordered<T>, TryRecvError> {
let looking_for = &self.ordered_matcher.looking_for;

loop {
if self.is_stop() {
return Err(TryRecvError::Disconnected);
Expand Down
8 changes: 4 additions & 4 deletions src/core/read_dir_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pub(crate) type ReadDirCallback<C> =

/// Result<ReadDir> Iterator.
///
/// Yeilds ReadDirs (results of fs::read_dir) in order required for recursive
/// Yields ReadDirs (results of fs::read_dir) in order required for recursive
/// directory traversal. Depending on Walk/ParWalk state these reads might be
/// computed in parellel.
/// computed in parallel.
pub enum ReadDirIter<C: ClientState> {
Walk {
read_dir_spec_stack: Vec<ReadDirSpec<C>>,
Expand Down Expand Up @@ -113,12 +113,12 @@ fn multi_threaded_walk_dir<C: ClientState>(
..
} = ordered_read_dir_spec;

let read_dir_result = (run_context.core_read_dir_callback)(read_dir_spec);
let read_dir_result = (run_context.core_read_dir_callback)(read_dir_spec);
let ordered_read_children_specs = read_dir_result
.as_ref()
.ok()
.map(|read_dir| read_dir.ordered_read_children_specs(&index_path));

let ordered_read_dir_result = Ordered::new(
read_dir_result,
index_path,
Expand Down
2 changes: 1 addition & 1 deletion src/core/read_dir_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ pub struct ReadDirSpec<C: ClientState> {
/// when reading this directory's parent. One intended use case is to store
/// `.gitignore` state to filter entries during the walk.
pub client_read_state: C::ReadDirState,
// Origins of synlinks followed to get to this entry.
// Origins of symlinks followed to get to this entry.
pub(crate) follow_link_ancestors: Arc<Vec<Arc<Path>>>,
}

0 comments on commit cc0009f

Please sign in to comment.