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

Builder::generate should not return Result<_, ()> #2124

Closed
MikuroXina opened this issue Dec 4, 2021 · 0 comments · Fixed by #2125
Closed

Builder::generate should not return Result<_, ()> #2124

MikuroXina opened this issue Dec 4, 2021 · 0 comments · Fixed by #2125

Comments

@MikuroXina
Copy link
Contributor

MikuroXina commented Dec 4, 2021

According to Clippy, it is not useful that Builder::generate (Bindings::generate internally) returns a Result<_, ()> because it carries no information about what went wrong. Currently the information is printed to stderr by eprintln!, but it is hard to handle an error programatically. I think that we should change it into a custom error type.

warning: this returns a `Result<_, ()>`
Warning:     --> src/lib.rs:1447:5
     |
1447 |     pub fn generate(mut self) -> Result<Bindings, ()> {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `#[warn(clippy::result_unit_err)]` on by default
     = help: use a custom `Error` type instead
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_unit_err

This introduces a breaking change, so we'll first add new improved method then deprecate the old one.

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 a pull request may close this issue.

1 participant