df: migrate OptionsError to thiserror#7673
Merged
sylvestre merged 2 commits intouutils:mainfrom Apr 10, 2025
Merged
Conversation
|
GNU testsuite comparison: |
sol-ontiver
reviewed
Apr 6, 2025
src/uu/df/src/df.rs
Outdated
| #[error("option --output: field {0} used more than once")] | ||
| ColumnError(ColumnError), | ||
|
|
||
| #[error("{}", .0.iter().map(|t| format!("file system type {} both selected and excluded", t.quote())).collect::<Vec<String>>().join(format!("\n{}: ", uucore::util_name()).as_str()))] |
There was a problem hiding this comment.
Nit: Formatting could help readability - e.g:
#[error("{}", .0.iter()
.map(|t| format!("file system type {} both selected and excluded", t.quote()))
.collect::<Vec<String>>()
.join(format!("\n{}: ", uucore::util_name()).as_str()))]
Contributor
There was a problem hiding this comment.
A detail: you can omit the String type and replace it with _.
Contributor
Author
There was a problem hiding this comment.
Thanks. Good ideas. I've updated the branch to incorporate both. Appreciate the feedback.
sylvestre
reviewed
Apr 6, 2025
| impl fmt::Display for OptionsError { | ||
| fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
| match self { | ||
| // TODO This needs to vary based on whether `--block-size` |
Contributor
There was a problem hiding this comment.
i think we want to keep the various TODO here
Contributor
Author
There was a problem hiding this comment.
Yes definitely. I took a look implementing the TODO but it certainly is harder than it seems. I get now why its a TODO. I'll take a look at that separately.
I've put the TODO comments back in. Thanks.
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
Contributor
|
thanks |
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.
Closes #7536
I'm not particularly happy with the solution for
FilesystemTypeBothSelectedAndExcluded, but it does pass the tests.I'd be happy to receive any feedback to improve it.
Thanks!