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

Replace unwrap calls with "more explicit" expect #402

Merged
merged 1 commit into from Nov 30, 2018

Conversation

Projects
None yet
3 participants
@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Nov 29, 2018

@EPashkin

This comment has been minimized.

Copy link
Member

EPashkin commented Nov 30, 2018

@GuillaumeGomez Thanks, 👍

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 30, 2018

Instead of "invalid string" you could also be more specific as this only happens if there's a "\0" somewhere in the string before the end. Otherwise seems fine to me

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Nov 30, 2018

Are you sure this is the only case where it could fail?

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 30, 2018

Yes: https://doc.rust-lang.org/std/ffi/struct.CString.html#method.new

It's part of the API, it can't possibly fail for anything but a NulError:

pub fn new<T: Into<Vec<u8>>>(t: T) -> Result<CString, NulError>
@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Nov 30, 2018

Ok then! I'll update the sentence when I can.

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:expect branch from df8785a to a71fe20 Nov 30, 2018

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Nov 30, 2018

Updated.

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 30, 2018

👍

@GuillaumeGomez GuillaumeGomez merged commit 36828d8 into gtk-rs:master Nov 30, 2018

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@GuillaumeGomez GuillaumeGomez deleted the GuillaumeGomez:expect branch Nov 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.