Move more errors to thiserror#7540
Merged
sylvestre merged 8 commits intouutils:mainfrom Mar 30, 2025
sgvictorino:thiserror
Merged
Move more errors to thiserror#7540sylvestre merged 8 commits intouutils:mainfrom sgvictorino:thiserror
sylvestre merged 8 commits intouutils:mainfrom
sgvictorino:thiserror
Conversation
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
Contributor
|
in general, please try to avoid doing many changes in the same pr (and leave good first bug for others ;) |
|
GNU testsuite comparison: |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the error handling across multiple utilities by replacing custom Display and Error implementations with the thiserror derive macro. Key changes include:
- Removing manual Error and Display impls and adding #[derive(Error)] with error attributes.
- Updating error message formatting to provide more consistent and maintainable error messages.
- Adding thiserror as a dependency to the affected Cargo.toml files.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/uu/wc/src/utf8/read.rs | Migrate error definitions to use thiserror. |
| src/uu/unexpand/src/unexpand.rs | Refactor ParseError to use thiserror with custom error messages. |
| src/uu/unexpand/Cargo.toml | Add thiserror dependency. |
| src/uu/tac/src/error.rs | Replace manual impls with thiserror-based error variants. |
| src/uu/tac/Cargo.toml | Add thiserror dependency. |
| src/uu/split/src/strategy.rs | Update NumberTypeError and StrategyError to use thiserror. |
| src/uu/split/src/split.rs | Refactor SettingsError to use thiserror. |
| src/uu/split/src/filenames.rs | Migrate SuffixError error handling to thiserror. |
| src/uu/split/Cargo.toml | Add thiserror dependency. |
| src/uu/ptx/src/ptx.rs | Update error variants to derive thiserror, removing Display impl. |
| src/uu/ptx/Cargo.toml | Add thiserror dependency. |
| src/uu/numfmt/src/errors.rs | Transition NumfmtError to use thiserror. |
| src/uu/numfmt/Cargo.toml | Add thiserror dependency. |
| src/uu/expand/src/expand.rs | Refactor ParseError to use thiserror attributes. |
| src/uu/expand/Cargo.toml | Add thiserror dependency. |
| src/uu/dd/src/parseargs.rs | Replace custom Display and Error impls with thiserror on ParseError. |
| src/uu/dd/Cargo.toml | Add thiserror dependency. |
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 #7538, closes #7534, closes #7533, closes #7532, closes #7531, closes #7530, closes #7529