-
Notifications
You must be signed in to change notification settings - Fork 707
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
Make --rustfmt-bindings
/Builder::rustfmt_bindings
on by default
#977
Comments
Yes, this is expected after the move off of syntex. There is Re: the /* automatically generated by rust-bindgen */
#[repr(C)]
#[derive(Debug, Copy)]
pub struct Doggo {
pub many: ::std::os::raw::c_int,
pub wow: ::std::os::raw::c_char,
}
impl Clone for Doggo {
fn clone(&self) -> Self { *self }
}
extern "C" {
pub fn eleven_out_of_ten_majestic_af(pupper: *mut Doggo);
} Which I think is fair. The README doesn't mention flags, it is just there to help people understand what bindgen does and why you might want to use it. That said, yes I recognize this situation is not ideal. Things I think we can do about it:
Things I think we can't do:
Any other ideas? |
Yeah, I think that what you say above is right: (IMO The current output is likely more of an issue for people like me who are long-term If the autogenerated code is either automatically passed through |
We just use the system |
--rustfmt-bindings
/Builder::rustfmt_bindings
on by default
Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the If you intend to work on this issue, then add |
I think we need to make |
I'd like to work on this, if possible! @highfive: assign me |
Hey @harlanhaskins! Thanks for your interest in working on this issue. It's now assigned to you! |
Enable --rustfmt-bindings by default This patch flips --rustfmt-bindings to --no-rustfmt-bindings and enables formatting by default. If rustfmt is not accessible, a warning is printed and the bindings are printed unformatted. Addresses #977.
Enable --rustfmt-bindings by default This patch flips --rustfmt-bindings to --no-rustfmt-bindings and enables formatting by default. If rustfmt is not accessible, a warning is printed and the bindings are printed unformatted. Addresses #977.
Fixed in #1022 |
Edited by @fitzgen
Ever since the switch to
quote
instead ofsyntex
, the bindings get emitted in a decidedly not-pretty-printed fashion.We have an option to run
rustfmt
on the bindings:--rustfmt-bindings
/Builder::rustfmt_bindings
. It is off by default, but it should be on by default. Instead, users should turn it off if they don't need it or want it.See
src/options.rs
andsrc/lib.rs
for the command line flags andBuilder
definition respectively.Original comment:
Bindgen could really do with sticking in some more newlines.
Eg at the moment I'm getting this 4000 character monstrosity, which I reckon should be about a hundred lines of code.
This is a recent regression. I assume, but have not verified, that it's a result of merging no-syntex.
Perhaps the intention is that I should always manually rustfmt the output? That does give an OK-ish solution - rustfmt does a pretty good job with the line that I linked above, though it fails later in the file with lines that are too long for it.
If the intention is that rustfmt is the solution then the docs should say something about this. Eg the
README
exampledoggo.h
actually gives output that's not much like what is promised:The text was updated successfully, but these errors were encountered: