Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/find/matchers/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
2 changes: 1 addition & 1 deletion src/find/matchers/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
2 changes: 1 addition & 1 deletion src/find/matchers/type_matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/find/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down Expand Up @@ -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);
}
Expand Down
10 changes: 4 additions & 6 deletions src/locate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/updatedb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down
4 changes: 2 additions & 2 deletions src/xargs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ impl MaxCharsCommandSizeLimiter {
}

#[cfg(windows)]
fn new_system(_env: &HashMap<OsString, OsString>) -> MaxCharsCommandSizeLimiter {
fn new_system(_env: &HashMap<OsString, OsString>) -> 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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/common/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
Loading