This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
ledger-tool: Switch subcommand dispatch from if-else to match #34644
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.
Problem
A future change will add more cases to this if-else if-...-else chain. Using a match statement will be easier to follow then a very long if-else if-... chain.
This change was broken out in order to have a higher signal to noise ratio in the subsequent change.
Summary of Changes
Switch if-else over to match, and then run cargo fmt which will adjust white space in a lot of places. The downstream PR that would build on top of this is #34597. Namely, this section here would look like this with the match statement:
This PR is probably only necessary if we desire to push to #34597; so while this PR should go in first, we may want to confirm that we like the changes introduced by #34597 first.
The first commit is the actual change, the rest is a result of new indentation and line wrapping form
cargo fmt