diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a42df3d2..140e7c0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,9 +11,15 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] + rust: + - 1.88.0 + - stable steps: - uses: actions/checkout@v7 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} # For bindgen: https://github.com/rust-lang/rust-bindgen/issues/1797 - uses: KyleMayes/install-llvm-action@v2 if: matrix.os == 'windows-latest' @@ -32,9 +38,15 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] + rust: + - 1.88.0 + - stable steps: - uses: actions/checkout@v7 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} # For bindgen: https://github.com/rust-lang/rust-bindgen/issues/1797 - uses: KyleMayes/install-llvm-action@v2 if: matrix.os == 'windows-latest' @@ -58,10 +70,20 @@ jobs: cargo fmt --all -- --check clippy: - name: cargo clippy -- -D warnings - runs-on: ubuntu-latest + name: cargo clippy + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + rust: + - 1.88.0 + - stable steps: - uses: actions/checkout@v7 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} + components: clippy - run: | cargo clippy --all-targets -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index c38eb746..df5a5b0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ version = "0.10.0" homepage = "https://github.com/uutils/findutils" repository = "https://github.com/uutils/findutils" edition = "2021" +rust-version = "1.88.0" license = "MIT" readme = "README.md" description = "Rust implementation of GNU findutils" diff --git a/src/find/matchers/path.rs b/src/find/matchers/path.rs index c9db3498..f3d00093 100644 --- a/src/find/matchers/path.rs +++ b/src/find/matchers/path.rs @@ -37,7 +37,7 @@ mod tests { // being in a glob. #[cfg(windows)] fn fix_up_glob_slashes(re: &str) -> String { - re.replace("/", "\\\\") + re.replace('/', "\\\\") } #[cfg(not(windows))] diff --git a/src/find/matchers/regex.rs b/src/find/matchers/regex.rs index 4b85e4d5..cf87f960 100644 --- a/src/find/matchers/regex.rs +++ b/src/find/matchers/regex.rs @@ -126,7 +126,7 @@ mod tests { // being in a regex. #[cfg(windows)] fn fix_up_regex_slashes(re: &str) -> String { - re.replace("/", r"\\") + re.replace('/', r"\\") } #[cfg(not(windows))] diff --git a/src/find/matchers/type_matcher.rs b/src/find/matchers/type_matcher.rs index a1af4889..1b7679a6 100644 --- a/src/find/matchers/type_matcher.rs +++ b/src/find/matchers/type_matcher.rs @@ -186,7 +186,7 @@ mod tests { } }; #[cfg(windows)] - let _ = { + { if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") { assert!( e.kind() == ErrorKind::AlreadyExists, diff --git a/src/find/mod.rs b/src/find/mod.rs index f6b80751..91e17ed3 100644 --- a/src/find/mod.rs +++ b/src/find/mod.rs @@ -450,7 +450,7 @@ mod tests { #[cfg(windows)] /// Windows-only bodge for converting between path separators. pub fn fix_up_slashes(path: &str) -> String { - path.replace("/", "\\") + path.replace('/', "\\") } #[cfg(not(windows))] @@ -494,6 +494,7 @@ mod tests { } /// Queue a response to be returned by the next call to confirm(). + #[cfg(unix)] pub fn push_confirm_response(&self, response: bool) { self.confirm_responses.borrow_mut().push_back(response); } diff --git a/src/locate/mod.rs b/src/locate/mod.rs index 06dbb00b..51e89fe8 100644 --- a/src/locate/mod.rs +++ b/src/locate/mod.rs @@ -572,13 +572,11 @@ fn match_entry(entry: &CStr, config: &Config, patterns: &Patterns) -> bool { } else { patterns.all_match(entry.as_ref()) } + } else if has_metachars { + // TODO: parse metacharacters + false } else { - if has_metachars { - // TODO: parse metacharacters - false - } else { - patterns.any_match(entry.as_ref()) - } + patterns.any_match(entry.as_ref()) }; // existence is always checked against the full path, even in `--basename` mode diff --git a/src/updatedb/mod.rs b/src/updatedb/mod.rs index 00dd5f4c..10b1f6b2 100644 --- a/src/updatedb/mod.rs +++ b/src/updatedb/mod.rs @@ -357,12 +357,12 @@ fn do_updatedb(args: &[&str]) -> UResult<()> { let frcoder = Frcoder::new(output.as_slice(), config.db_format); writer .write_all(&frcoder.generate_header()) - .map_err(&write_err)?; + .map_err(write_err)?; for v in frcoder { - writer.write_all(v.as_slice()).map_err(&write_err)?; + writer.write_all(v.as_slice()).map_err(write_err)?; } - writer.flush().map_err(&write_err)?; + writer.flush().map_err(write_err)?; Ok(()) } diff --git a/src/xargs/mod.rs b/src/xargs/mod.rs index ff833335..30177450 100644 --- a/src/xargs/mod.rs +++ b/src/xargs/mod.rs @@ -206,11 +206,11 @@ impl MaxCharsCommandSizeLimiter { } #[cfg(windows)] - fn new_system(_env: &HashMap) -> MaxCharsCommandSizeLimiter { + fn new_system(_env: &HashMap) -> Self { // Taken from the CreateProcess docs. -2 to account for how // std::process unconditionally surrounds the program name with quotes. const MAX_CMDLINE: usize = 32767 - 2; - MaxCharsCommandSizeLimiter::new(MAX_CMDLINE) + Self::new(MAX_CMDLINE) } #[cfg(unix)] diff --git a/tests/common/test_helpers.rs b/tests/common/test_helpers.rs index acf5a526..a1cf9d8c 100644 --- a/tests/common/test_helpers.rs +++ b/tests/common/test_helpers.rs @@ -90,7 +90,7 @@ pub fn path_to_testing_commandline() -> String { /// TODO: find out how to share #[cfg(test)] functions/structs between unit /// and integration tests. pub fn fix_up_slashes(path: &str) -> String { - path.replace("/", "\\") + path.replace('/', "\\") } #[cfg(not(windows))] diff --git a/tests/test_find.rs b/tests/test_find.rs index ce223d56..f2cde9df 100644 --- a/tests/test_find.rs +++ b/tests/test_find.rs @@ -37,7 +37,7 @@ fn ucmd() -> uutests::util::UCommand { // use in a regex. #[cfg(windows)] fn fix_up_regex_slashes(re: &str) -> String { - re.replace("/", "\\\\") + re.replace('/', "\\\\") } #[cfg(not(windows))]