Skip to content
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

Improve error docs... and make some of the generated code a bit more readable #580

Merged
merged 4 commits into from
Dec 31, 2020

Conversation

psychon
Copy link
Owner

@psychon psychon commented Dec 31, 2020

For a while now I had "improve docs for ParseError" on my to do list. I finally tackled this. For this, I looked at the generated code and checked when each of the errors could appear. I also found some types in the docs for ConnectError. Thus, this is now a PR with four commits and only one of them is about what I actually wanted to do...

This commit adds a crate-internal trait that allows to shorten
x.try_into().or(Err(ParseError::ConversionFailed)) to x.try_to_usize().
This also makes the code generator use this new trait/function.

Thanks to this change, many of the affected expressions now actually fit
into a single line on my screen!

Signed-off-by: Uli Schlachter <[email protected]>
This commit deals with two / four special cases that were not dealt with
in the previous commit yet.

Signed-off-by: Uli Schlachter <[email protected]>
@mergify mergify bot merged commit 0aa9f2b into master Dec 31, 2020
@mergify mergify bot deleted the error-docs branch December 31, 2020 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants