-
Notifications
You must be signed in to change notification settings - Fork 30
Fix all clippy warnings across the codebase #532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
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]>
There was a problem hiding this 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_constantandexcessive_precisionwarnings - Updated test patterns to use let-else instead of expect for optional environment variables
- Changed function parameters from
&PathBufto&Pathfor 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]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.