Skip to content

Conversation

@jgarzik
Copy link
Contributor

@jgarzik jgarzik commented Jan 16, 2026

  • awk: Change test values to avoid approx_constant and excessive_precision
  • tree/tests: Fix option_env_unwrap by using let-else pattern
  • m4/tests: Remove unnecessary & before Path::new calls
  • sh/wordexp: Use struct init syntax instead of field reassignment
  • editors/tests: Use struct init syntax instead of field reassignment
  • sccs/tests: Change &PathBuf to &Path in function signatures
  • tree/tests/chgrp: Rename _1/_2/_3 to dir1/dir2/dir3
  • tree/tests/chmod: Change filter_map to filter
  • process/tests/fuser: Add .wait() after .kill() for zombie processes
  • file/tests/cmp: Use iterator instead of index loop
  • Various auto-fixes via clippy --fix: useless_format, let_and_return, expect_fun_call, needless_borrow, let_unit_value, redundant pattern matching, to_string_in_format_args, trim before split_whitespace

- awk: Change test values to avoid approx_constant and excessive_precision
- tree/tests: Fix option_env_unwrap by using let-else pattern
- m4/tests: Remove unnecessary & before Path::new calls
- sh/wordexp: Use struct init syntax instead of field reassignment
- editors/tests: Use struct init syntax instead of field reassignment
- sccs/tests: Change &PathBuf to &Path in function signatures
- tree/tests/chgrp: Rename _1/_2/_3 to dir1/dir2/dir3
- tree/tests/chmod: Change filter_map to filter
- process/tests/fuser: Add .wait() after .kill() for zombie processes
- file/tests/cmp: Use iterator instead of index loop
- Various auto-fixes via clippy --fix: useless_format, let_and_return,
  expect_fun_call, needless_borrow, let_unit_value, redundant pattern
  matching, to_string_in_format_args, trim before split_whitespace

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses clippy warnings across the entire posixutils-rs codebase by applying various automatic and manual fixes to improve code quality and consistency.

Changes:

  • Removed unnecessary type conversions, format macros, and borrows
  • Changed test values to avoid clippy approx_constant and excessive_precision warnings
  • Updated test patterns to use let-else instead of expect for optional environment variables
  • Changed function parameters from &PathBuf to &Path for better ergonomics
  • Improved variable naming in test code
  • Added .wait() calls after .kill() to prevent zombie processes
  • Fixed iterator usage patterns

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
users/tests/write/mod.rs Simplified arithmetic by removing unnecessary 0u8 +
tree/tests/rm/mod.rs Changed option_env handling from expect to let-else pattern
tree/tests/readlink/mod.rs Replaced redundant format! with direct to_string()
tree/tests/mv/mod.rs Removed unnecessary to_string() in format!, updated option_env handling
tree/tests/ls/mod.rs Removed redundant field name, simplified conditionals, removed unnecessary format!
tree/tests/cp/mod.rs Updated option_env handling to let-else pattern
tree/tests/chown/mod.rs Changed iterator from into_iter to iter, removed unnecessary format! calls
tree/tests/chmod/mod.rs Changed filter_map to filter for simpler boolean logic
tree/tests/chgrp/mod.rs Renamed variables from _1/_2/_3 to dir1/dir2/dir3 for clarity
text/tests/csplit/mod.rs Changed vec! to array literal for fixed-size collections
sys/tests/uname/mod.rs Removed redundant trim before split_whitespace
sh/wordexp/pathname.rs Changed into_iter to iter for borrowed iteration
sh/wordexp/parameter.rs Used struct initialization syntax instead of field reassignment
sh/tests/integration.rs Removed unnecessary reference, added spin_loop hint
sh/pattern/regex.rs Removed redundant reference
sccs/tests/delta/mod.rs Changed &PathBuf to &Path in function signatures
process/tests/timeout/mod.rs Changed expect with format to unwrap_or_else, simplified iteration
process/tests/fuser/with_user.rs Added wait() after kill() to prevent zombie processes
process/tests/fuser/basic.rs Added wait() after kill() to prevent zombie processes
plib/src/sccsfile.rs Changed expect with format to unwrap_or_else
man/man_util/formatter.rs Replaced redundant format! with direct to_string()
m4/tests/integration_test.rs Added unnecessary references to Path::new calls
m4/test-manager/src/lib.rs Changed assert_eq with true to assert!
ftw/tests/integration.rs Replaced redundant format! with to_string()
file/tests/file/mod.rs Changed if let Ok(_) pattern to is_ok(), removed let _ = pattern
file/tests/cmp/mod.rs Changed indexed loop to iterator, changed char as u8 to byte literal
editors/tests/integration/mod.rs Used struct initialization syntax instead of field reassignment
datetime/tests/time/mod.rs Removed let-and-return pattern
cron/tests/crontab/mod.rs Changed expect with format to unwrap_or_else, removed let-and-return
cron/tests/crond/mod.rs Changed expect with format to unwrap_or_else, removed let-and-return, removed let _ = pattern
awk/interpreter/format.rs Changed test values to avoid excessive_precision warnings

- m4/tests: Remove unnecessary & before Path::new() calls (76 instances)
- tree/tests/chown: Add .copied() to fix HashSet type mismatch

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@jgarzik jgarzik merged commit 04e07dd into main Jan 16, 2026
4 checks passed
@jgarzik jgarzik deleted the updates branch January 16, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants