File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -927,22 +927,24 @@ impl Bindings {
927
927
928
928
/// Write these bindings as source text to the given `Write`able.
929
929
pub fn write < ' a > ( & self , mut writer : Box < dyn Write + ' a > ) -> io:: Result < ( ) > {
930
+ const NL : & str = if cfg ! ( windows) { "\r \n " } else { "\n " } ;
931
+
930
932
if !self . options . disable_header_comment {
931
933
let version =
932
934
option_env ! ( "CARGO_PKG_VERSION" ) . unwrap_or ( "(unknown version)" ) ;
933
- let header = format ! (
934
- "/* automatically generated by rust-bindgen {version} */ \n \n " ,
935
- ) ;
936
- writer . write_all ( header . as_bytes ( ) ) ?;
935
+ writeln ! (
936
+ writer ,
937
+ "/* automatically generated by rust-bindgen {version} */{NL}" ,
938
+ ) ?;
937
939
}
938
940
939
941
for line in self . options . raw_lines . iter ( ) {
940
942
writer. write_all ( line. as_bytes ( ) ) ?;
941
- writer. write_all ( " \n " . as_bytes ( ) ) ?;
943
+ writer. write_all ( NL . as_bytes ( ) ) ?;
942
944
}
943
945
944
946
if !self . options . raw_lines . is_empty ( ) {
945
- writer. write_all ( " \n " . as_bytes ( ) ) ?;
947
+ writer. write_all ( NL . as_bytes ( ) ) ?;
946
948
}
947
949
948
950
match self . format_tokens ( & self . module ) {
You can’t perform that action at this time.
0 commit comments