From fd4bd6acfaf511b5a0131c7bc4e35bc23c9d5068 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 8 Jun 2026 22:25:29 +0200 Subject: [PATCH] find,xargs: fix clippy::items_after_statements --- src/locate/mod.rs | 14 +++++++------- src/xargs/mod.rs | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/locate/mod.rs b/src/locate/mod.rs index a9a4d3a..3eb399c 100644 --- a/src/locate/mod.rs +++ b/src/locate/mod.rs @@ -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 { diff --git a/src/xargs/mod.rs b/src/xargs/mod.rs index 92924bd..eb0c82e 100644 --- a/src/xargs/mod.rs +++ b/src/xargs/mod.rs @@ -514,17 +514,17 @@ where R: Read, { fn next(&mut self) -> io::Result> { + 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 = None; let mut i = 0; loop {