find,xargs: fix clippy::items_after_statements

This commit is contained in:
Sylvestre Ledru
2026-06-08 22:25:29 +02:00
parent fa4f90befb
commit fd4bd6acfa
2 changed files with 12 additions and 12 deletions
+7 -7
View File
@@ -528,6 +528,13 @@ fn path_exists(path: &Path, follow_symlinks: bool) -> bool {
}
fn match_entry(entry: &CStr, config: &Config, patterns: &Patterns) -> bool {
// glob metacharacters in a stored path aren't handled yet, so such entries are skipped. On
// Windows `\` is the path separator (present in every path), so it must not count here.
#[cfg(windows)]
const GLOB_METACHARS: &str = "*?[]";
#[cfg(not(windows))]
const GLOB_METACHARS: &str = r"*?[]\";
let buf = bytes_to_path(entry.to_bytes());
let name = if config.basename {
let Some(path) = buf.file_name() else {
@@ -552,13 +559,6 @@ fn match_entry(entry: &CStr, config: &Config, patterns: &Patterns) -> bool {
};
let entry = name.to_string_lossy();
// glob metacharacters in a stored path aren't handled yet, so such entries are skipped. On
// Windows `\` is the path separator (present in every path), so it must not count here.
#[cfg(windows)]
const GLOB_METACHARS: &str = "*?[]";
#[cfg(not(windows))]
const GLOB_METACHARS: &str = r"*?[]\";
let has_metachars = entry.chars().any(|c| GLOB_METACHARS.contains(c));
let patterns_match = if config.all {
if has_metachars {
+5 -5
View File
@@ -514,17 +514,17 @@ where
R: Read,
{
fn next(&mut self) -> io::Result<Option<Argument>> {
enum Escape {
Slash,
Quote(u8),
}
let mut result = vec![];
let mut terminated_by_newline = false;
let mut pending = vec![];
std::mem::swap(&mut pending, &mut self.pending);
enum Escape {
Slash,
Quote(u8),
}
let mut escape: Option<Escape> = None;
let mut i = 0;
loop {