chgrp: use map instead of match in parse_gid_and_uid() - #13620
Open
Devel08 wants to merge 7 commits into
Open
Conversation
|
GNU testsuite comparison: |
Contributor
|
Instead of formatting the error inline, we could follow the pattern used by other utils and introduce the That would let us move the error definitions into an enum, e.g.: #[derive(Error, Debug)]
enum ChgrpError {
#[error("{}", translate!("chgrp-error-invalid-user", "from_group" => .from_group))]
InvalidUser { from_group: String },
} |
xtqqczze
reviewed
Jul 29, 2026
| InvalidUser { from_group: String }, | ||
| } | ||
|
|
||
| impl UError for ChgrpError { |
Contributor
There was a problem hiding this comment.
The default implementation will already use an exit code of 1:
impl UError for ChgrpError {}
xtqqczze
reviewed
Jul 29, 2026
| clap = { workspace = true } | ||
| uucore = { workspace = true, features = ["entries", "fs", "perms"] } | ||
| fluent = { workspace = true } | ||
| thiserror = { workspace = true } |
Contributor
There was a problem hiding this comment.
nit: can this go between clap and uucore?
At some point I want to alphabetise these sections and that will minimise the diff.
Contributor
|
LGTM |
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.
No description provided.