diff --git a/src/find/matchers/logical_matchers.rs b/src/find/matchers/logical_matchers.rs index 6f04b34..4530154 100644 --- a/src/find/matchers/logical_matchers.rs +++ b/src/find/matchers/logical_matchers.rs @@ -35,11 +35,11 @@ impl Matcher for AndMatcher { /// place. If the nth sub-matcher returns false, then we immediately return /// and don't make any further calls. fn matches(&self, dir_entry: &DirEntry, matcher_io: &mut MatcherIO) -> bool { - self.submatchers.iter().all(|ref x| x.matches(dir_entry, matcher_io)) + self.submatchers.iter().all(|x| x.matches(dir_entry, matcher_io)) } fn has_side_effects(&self) -> bool { - self.submatchers.iter().any(|ref x| x.has_side_effects()) + self.submatchers.iter().any(|x| x.has_side_effects()) } } @@ -91,11 +91,11 @@ impl Matcher for OrMatcher { /// place. If the nth sub-matcher returns true, then we immediately return /// and don't make any further calls. fn matches(&self, dir_entry: &DirEntry, matcher_io: &mut MatcherIO) -> bool { - self.submatchers.iter().any(|ref x| x.matches(dir_entry, matcher_io)) + self.submatchers.iter().any(|x| x.matches(dir_entry, matcher_io)) } fn has_side_effects(&self) -> bool { - self.submatchers.iter().any(|ref x| x.has_side_effects()) + self.submatchers.iter().any(|x| x.has_side_effects()) } } @@ -142,10 +142,10 @@ impl OrMatcherBuilder { /// This matcher contains a collection of other matchers. In contrast to -/// OrMatcher and AndMatcher, all the submatcher objects are called regardless -/// of the results of previous submatchers. This is primarily used for -/// submatchers with side-effects. For such sub-matchers the side effects occur -/// in the same order as the sub-matchers were pushed into the collection. +/// `OrMatcher` and `AndMatcher`, all the submatcher objects are called +/// regardless of the results of previous submatchers. This is primarily used +/// for submatchers with side-effects. For such sub-matchers the side effects +/// occur in the same order as the sub-matchers were pushed into the collection. pub struct ListMatcher { submatchers: Vec>, } @@ -162,14 +162,14 @@ impl Matcher for ListMatcher { /// Returns the result of the call to the final submatcher fn matches(&self, dir_entry: &DirEntry, matcher_io: &mut MatcherIO) -> bool { let mut rc = false; - for ref matcher in &self.submatchers { + for matcher in &self.submatchers { rc = matcher.matches(dir_entry, matcher_io); } rc } fn has_side_effects(&self) -> bool { - self.submatchers.iter().any(|ref x| x.has_side_effects()) + self.submatchers.iter().any(|x| x.has_side_effects()) } } diff --git a/src/find/matchers/mod.rs b/src/find/matchers/mod.rs index 8a88b26..288e767 100644 --- a/src/find/matchers/mod.rs +++ b/src/find/matchers/mod.rs @@ -90,7 +90,7 @@ impl ComparableValue { } -/// Builds a single AndMatcher containing the Matcher objects corresponding +/// Builds a single `AndMatcher` containing the Matcher objects corresponding /// to the passed in predicate arguments. pub fn build_top_level_matcher(args: &[&str], config: &mut Config) @@ -107,13 +107,13 @@ pub fn build_top_level_matcher(args: &[&str], Ok(top_level_matcher) } -/// Helper function for build_matcher_tree +/// Helper function for `build_matcher_tree`. fn are_more_expressions(args: &[&str], index: usize) -> bool { (index < args.len() - 1) && args[index + 1] != ")" } fn convert_arg_to_number(option_name: &str, value_as_string: &str) -> Result> { - return match value_as_string.parse::() { + match value_as_string.parse::() { Ok(val) => Ok(val), _ => { Err(From::from(format!("Expected a positive decimal integer argument to {}, but got \ @@ -121,7 +121,7 @@ fn convert_arg_to_number(option_name: &str, value_as_string: &str) -> Result bool { - return self.pattern.matches(file_info.file_name().to_string_lossy().as_ref()); + self.pattern.matches(file_info.file_name().to_string_lossy().as_ref()) } fn has_side_effects(&self) -> bool { @@ -39,7 +39,7 @@ impl Matcher for NameMatcher { } /// This matcher makes a case-insensitive comparison of the name against a -/// shell wildcard pattern. See glob::Pattern for details on the exact +/// shell wildcard pattern. See `glob::Pattern` for details on the exact /// syntax. pub struct CaselessNameMatcher { pattern: Pattern, @@ -58,8 +58,8 @@ impl CaselessNameMatcher { impl super::Matcher for CaselessNameMatcher { fn matches(&self, file_info: &DirEntry, _: &mut MatcherIO) -> bool { - return self.pattern - .matches(file_info.file_name().to_string_lossy().to_lowercase().as_ref()); + self.pattern + .matches(file_info.file_name().to_string_lossy().to_lowercase().as_ref()) } fn has_side_effects(&self) -> bool { diff --git a/src/find/matchers/prune.rs b/src/find/matchers/prune.rs index de2e8ab..f740779 100644 --- a/src/find/matchers/prune.rs +++ b/src/find/matchers/prune.rs @@ -24,7 +24,7 @@ impl PruneMatcher { impl Matcher for PruneMatcher { fn matches(&self, _: &DirEntry, matcher_io: &mut MatcherIO) -> bool { matcher_io.mark_current_dir_to_be_skipped(); - return true; + true } fn has_side_effects(&self) -> bool { diff --git a/src/find/mod.rs b/src/find/mod.rs index a355a2c..b8a421c 100644 --- a/src/find/mod.rs +++ b/src/find/mod.rs @@ -72,7 +72,7 @@ struct ParsedInfo { config: Config, } -/// Function to generate a ParsedInfo from the strings supplied on the command-line. +/// Function to generate a `ParsedInfo` from the strings supplied on the command-line. fn parse_args(args: &[&str]) -> Result> { let mut paths = vec![]; let mut i = 0;