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

Add new nullable_return_is_error configuration for return types #883

Merged
merged 2 commits into from Dec 17, 2019

Conversation

sdroege
Copy link
Member

@sdroege sdroege commented Dec 17, 2019

This allows converting an Option into an Result<T, glib::BoolError>,
which in case of Option signalling error allows for more ergonomic error
handling code.


CC @EPashkin @GuillaumeGomez

@EPashkin
Copy link
Member

Also new warning than IMHO better ignored by "#[allow(clippy::large_enum_variant))".

warning: large size difference between variants
  --> src\chunk\chunk.rs:23:5
   |
23 | /     FfiCallConversion {
24 | |         ret: return_value::Info,
25 | |         array_length_name: Option<String>,
26 | |         call: Box<Chunk>,
27 | |     },
   | |_____^
   |
   = note: `#[warn(clippy::large_enum_variant)]` on by default
help: consider boxing the large fields to reduce the total size of the enum
  --> src\chunk\chunk.rs:23:5
   |
23 | /     FfiCallConversion {
24 | |         ret: return_value::Info,
25 | |         array_length_name: Option<String>,
26 | |         call: Box<Chunk>,
27 | |     },
   | |_____^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant

This allows converting an Option<T> into an Result<T, glib::BoolError>,
which in case of Option signalling error allows for more ergonomic error
handling code.
@sdroege
Copy link
Member Author

sdroege commented Dec 17, 2019

Fixed, and also some other clippy warnings. Thanks for the review

@EPashkin
Copy link
Member

@sdroege Big thanks

@EPashkin EPashkin merged commit 5836573 into gtk-rs:master Dec 17, 2019
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.

None yet

3 participants