ps: Refactor process selection + support new flags#559
Merged
cakebaker merged 11 commits intouutils:mainfrom Nov 3, 2025
Merged
ps: Refactor process selection + support new flags#559cakebaker merged 11 commits intouutils:mainfrom
cakebaker merged 11 commits intouutils:mainfrom
Conversation
error: implicitly cloning a `String` by calling `to_string` on its dereferenced type
--> src/uu/pgrep/src/process_matcher.rs:212:8
|
212 | Ok(pattern.to_string())
| ^^^^^^^^^^^^^^^^^^^ help: consider using: `pattern.clone()`
|
error: implicitly cloning a `String` by calling `to_string` on its dereferenced type
--> src/uu/slabtop/src/parse.rs:296:13
|
296 | name.to_string(),
| ^^^^^^^^^^^^^^^^ help: consider using: `name.clone()`
error: implicitly cloning a `String` by calling `to_string` on its dereferenced type
--> src/uu/vmstat/src/picker.rs:327:16
|
327 | vec![(len, runnable.to_string()), (len, blocked.to_string())]
| ^^^^^^^^^^^^^^^^^^^^ help: consider using: `runnable.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.91.0/index.html#implicit_clone
= note: `-D clippy::implicit-clone` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::implicit_clone)]`
error: implicitly cloning a `String` by calling `to_string` on its dereferenced type
--> src/uu/vmstat/src/picker.rs:327:45
|
327 | vec![(len, runnable.to_string()), (len, blocked.to_string())]
| ^^^^^^^^^^^^^^^^^^^ help: consider using: `blocked.clone()`
error: implicitly cloning a `String` by calling `to_string` on its dereferenced type --> src/uu/ps/src/mapping.rs:18:39 | 18 | None => (key.clone(), mapping.get(&key).unwrap().to_string()), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `mapping.get(&key).unwrap().clone()` | error: implicitly cloning a `String` by calling `to_string` on its dereferenced type --> src/uu/ps/src/ps.rs:97:40 | 97 | .map(|code| (code.clone(), default_mapping[&code].to_string())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `default_mapping[&code].clone()`
ba07bcd to
43c51e1
Compare
cakebaker
reviewed
Nov 3, 2025
Refactor the process selection to better support cases where the behaviour is more complex than simply union of what each individual flag would list. This is bit similar to what is used in pgrep.
For example, `ps --deselect -A` or `ps --pid` for non existing pid trigger this.
cakebaker
reviewed
Nov 3, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #559 +/- ##
===========================
===========================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
Thanks, both for the PR and fixing the clippy errors! |
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
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.
Refactor the process selection to better support cases where the behaviour is more complex than simply union of what each individual flag would list. This is bit similar to what is used in pgrep. Also implement new flags that are easier to implement now.