-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
df: migrate OptionsError to thiserror #7673
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
Conversation
GNU testsuite comparison:
|
src/uu/df/src/df.rs
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()))]
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.
A detail: you can omit the String
type and replace it with _
.
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.
Thanks. Good ideas. I've updated the branch to incorporate both. Appreciate the feedback.
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` |
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.
i think we want to keep the various TODO here
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.
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:
|
thanks |
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!