-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
libgraphviz: Id::new returns Result<Id, ()> instead of panicking on error #18921
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
libgraphviz: Id::new returns Result<Id, ()> instead of panicking on error #18921
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon. |
|
sorry, didn't know about |
0798273 to
f4ba7ee
Compare
src/libgraphviz/lib.rs
Outdated
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.
Could you update the documentation of this function to include the error cases as well? It's not totally clear when Err would be returned for example.
f4ba7ee to
6221f7e
Compare
src/libgraphviz/lib.rs
Outdated
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.
@alexcrichton like this or should i create an example?
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.
Looks good to me, thanks!
6221f7e to
d0edf59
Compare
abbc1cc to
9c06cb7
Compare
…rror creating a new Id object requires the format to match a subset of `ID` format defined by the DOT language. When the format did not match, the function called assert. This was not mentioned in the docs or the spec. I made the failure explicit by returning an Result<Id, ()>.
9c06cb7 to
70bf4f7
Compare
|
the tests are now two separate tests (and they compile). |
|
Thanks @oli-obk! |
internal: Compute inlay hint text edits lazily
creating a new Id object requires the format to match a subset of
IDformat defined by the DOT language. When the format did not match, the function called assert. This was not mentioned in the docs or the spec. I made the failure explicit by returning an Result<Id, ()>.