rust-bindgen: rustfmt_bindings(true) doesn't format the output file
Input C/C++ Header
https://github.com/chaoticbob/SPIRV-Reflect/blob/master/spirv_reflect.h
Bindgen Invocation
let bindings = bindgen::Builder::default()
.header("spirv_reflect.h")
.rustfmt_bindings(true)
.layout_tests(false)
.generate()
.expect("Unable to generate bindings!");
bindings
.write_to_file(std::path::Path::new(output.rs))
.expect("Unable to write bindings!");
Actual Results
It doesn’t make any difference if I use this with .rustfmt_bindings(true) or .rustfmt_bindings(false) for the constants defined at the top of the file. They are all on one line.
I am on the 0.43.1 version.
Expected Results
I would have expected the file to look like it does after I run rustfmt on it (in vscode with rls), with every constant on a new line.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 17 (12 by maintainers)
I use command-line bindgen on windows and it wasn’t formatting until I installed rustfmt:
rustup component add rustfmt