From 41b1060e4efa7a826f9b2186753f73a5e8d85623 Mon Sep 17 00:00:00 2001
From: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
Date: Sat, 10 Oct 2026 16:11:50 +0100
Subject: [PATCH] refactor: bump edition to 2024
---
Cargo.toml | 2 +-
benches/find_bench.rs | 4 +-
benches/locate_bench.rs | 2 +-
benches/updatedb_bench.rs | 2 +-
benches/xargs_bench.rs | 2 +-
src/find/matchers/delete.rs | 4 +-
src/find/matchers/empty.rs | 2 +-
src/find/matchers/entry.rs | 16 +-
src/find/matchers/exec.rs | 2 +-
src/find/matchers/fs.rs | 14 +-
src/find/matchers/group.rs | 2 +-
src/find/matchers/lname.rs | 2 +-
src/find/matchers/ls.rs | 7 +-
src/find/matchers/mod.rs | 350 ++++++++++++++++++------------
src/find/matchers/perm.rs | 4 +-
src/find/matchers/printer.rs | 4 +-
src/find/matchers/printf.rs | 8 +-
src/find/matchers/size.rs | 19 +-
src/find/matchers/time.rs | 2 +-
src/find/matchers/type_matcher.rs | 12 +-
src/find/matchers/user.rs | 2 +-
src/find/mod.rs | 16 +-
src/locate/mod.rs | 34 +--
src/testing/commandline/main.rs | 2 +-
src/updatedb/mod.rs | 8 +-
src/xargs/mod.rs | 247 ++++++++++++---------
tests/common/mod.rs | 6 +-
tests/common/test_helpers.rs | 2 +-
tests/exec_unit_tests.rs | 2 +-
tests/find_exec_tests.rs | 2 +-
tests/test_find.rs | 2 +-
31 files changed, 457 insertions(+), 326 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 54cb21bd..b51b1d85 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ name = "findutils"
version = "0.11.0"
homepage = "https://github.com/uutils/findutils"
repository = "https://github.com/uutils/findutils"
-edition = "2021"
+edition = "2024"
rust-version = "1.88.0"
license = "MIT"
readme = "README.md"
diff --git a/benches/find_bench.rs b/benches/find_bench.rs
index 69082faa..9a42f059 100644
--- a/benches/find_bench.rs
+++ b/benches/find_bench.rs
@@ -14,8 +14,8 @@ use std::io::{self, Write};
use std::path::{Path, PathBuf};
use std::time::SystemTime;
-use criterion::{black_box, criterion_group, criterion_main, Criterion};
-use findutils::find::{find_main, Dependencies};
+use criterion::{Criterion, black_box, criterion_group, criterion_main};
+use findutils::find::{Dependencies, find_main};
/// `Dependencies` implementation that throws output away. A fixed `now` keeps
/// time-based matchers (`-newer`, `-mtime`, …) deterministic across runs.
diff --git a/benches/locate_bench.rs b/benches/locate_bench.rs
index 2c4c4737..f18c9949 100644
--- a/benches/locate_bench.rs
+++ b/benches/locate_bench.rs
@@ -16,7 +16,7 @@
mod bench {
use std::path::{Path, PathBuf};
- use criterion::{black_box, criterion_group, Criterion};
+ use criterion::{Criterion, black_box, criterion_group};
use findutils::locate::locate_main;
use findutils::updatedb::updatedb_main;
diff --git a/benches/updatedb_bench.rs b/benches/updatedb_bench.rs
index 20ed69c2..86e15f02 100644
--- a/benches/updatedb_bench.rs
+++ b/benches/updatedb_bench.rs
@@ -11,7 +11,7 @@
use std::path::{Path, PathBuf};
-use criterion::{black_box, criterion_group, criterion_main, Criterion};
+use criterion::{Criterion, black_box, criterion_group, criterion_main};
use findutils::updatedb::updatedb_main;
/// Run `updatedb` end-to-end. `args` are the arguments after the program name.
diff --git a/benches/xargs_bench.rs b/benches/xargs_bench.rs
index 2be2a057..a2c814c3 100644
--- a/benches/xargs_bench.rs
+++ b/benches/xargs_bench.rs
@@ -12,7 +12,7 @@
use std::path::PathBuf;
-use criterion::{black_box, criterion_group, criterion_main, Criterion};
+use criterion::{Criterion, black_box, criterion_group, criterion_main};
use findutils::xargs::xargs_main;
/// Run `xargs` end-to-end. `args` are the arguments after the program name.
diff --git a/src/find/matchers/delete.rs b/src/find/matchers/delete.rs
index 354db309..b9cc1153 100644
--- a/src/find/matchers/delete.rs
+++ b/src/find/matchers/delete.rs
@@ -8,7 +8,7 @@
*/
use std::fs;
-use std::io::{self, stderr, Write};
+use std::io::{self, Write, stderr};
use super::{Matcher, MatcherIO, WalkEntry};
@@ -57,7 +57,7 @@ impl Matcher for DeleteMatcher {
#[cfg(test)]
mod tests {
- use std::fs::{create_dir, File};
+ use std::fs::{File, create_dir};
use tempfile::Builder;
use super::*;
diff --git a/src/find/matchers/empty.rs b/src/find/matchers/empty.rs
index 9770dffe..ef035e0b 100644
--- a/src/find/matchers/empty.rs
+++ b/src/find/matchers/empty.rs
@@ -6,7 +6,7 @@
use std::{
fs::read_dir,
- io::{stderr, Write},
+ io::{Write, stderr},
};
use super::{Matcher, MatcherIO, WalkEntry};
diff --git a/src/find/matchers/entry.rs b/src/find/matchers/entry.rs
index 649413d3..2d44e6bd 100644
--- a/src/find/matchers/entry.rs
+++ b/src/find/matchers/entry.rs
@@ -239,14 +239,14 @@ impl WalkEntry {
}
Err(e) if e.is_not_found() => {
// Detect broken symlinks and replace them with explicit entries
- if let (Some(path), Some(depth)) = (e.path(), e.depth()) {
- if let Ok(meta) = path.symlink_metadata() {
- return Ok(Self {
- inner: Entry::Explicit(path.into(), depth),
- follow: Follow::Never,
- meta: Ok(meta).into(),
- });
- }
+ if let (Some(path), Some(depth)) = (e.path(), e.depth())
+ && let Ok(meta) = path.symlink_metadata()
+ {
+ return Ok(Self {
+ inner: Entry::Explicit(path.into(), depth),
+ follow: Follow::Never,
+ meta: Ok(meta).into(),
+ });
}
Err(e)
diff --git a/src/find/matchers/exec.rs b/src/find/matchers/exec.rs
index f1170046..51bb3c77 100644
--- a/src/find/matchers/exec.rs
+++ b/src/find/matchers/exec.rs
@@ -7,7 +7,7 @@
use std::cell::RefCell;
use std::error::Error;
use std::ffi::{OsStr, OsString};
-use std::io::{stderr, Write};
+use std::io::{Write, stderr};
use std::path::Path;
use std::process::Command;
diff --git a/src/find/matchers/fs.rs b/src/find/matchers/fs.rs
index f8ae47b6..79894620 100644
--- a/src/find/matchers/fs.rs
+++ b/src/find/matchers/fs.rs
@@ -28,7 +28,7 @@ pub struct Cache {
#[cfg(unix)]
use std::{
cell::RefCell,
- io::{stderr, Write},
+ io::{Write, stderr},
path::Path,
};
@@ -54,10 +54,10 @@ pub fn get_file_system_type(path: &Path, cache: &RefCell