@@ -87,10 +87,10 @@ const DEFAULT_NON_EXTERN_FNS_SUFFIX: &str = "__extern";
8787
8888fn file_is_cpp ( name_file : & str ) -> bool {
8989 Path :: new ( name_file) . extension ( ) . is_some_and ( |ext| {
90- ext. eq_ignore_ascii_case ( "hpp" ) ||
91- ext. eq_ignore_ascii_case ( "hxx" ) ||
92- ext. eq_ignore_ascii_case ( "hh" ) ||
93- ext. eq_ignore_ascii_case ( "h++" )
90+ ext. eq_ignore_ascii_case ( "hpp" )
91+ || ext. eq_ignore_ascii_case ( "hxx" )
92+ || ext. eq_ignore_ascii_case ( "hh" )
93+ || ext. eq_ignore_ascii_case ( "h++" )
9494 } )
9595}
9696
@@ -347,10 +347,10 @@ impl Builder {
347347 . clang_args
348348 . iter ( )
349349 . filter ( |arg| {
350- !arg. starts_with ( "-MMD" ) &&
351- !arg. starts_with ( "-MD" ) &&
352- !arg. starts_with ( "--write-user-dependencies" ) &&
353- !arg. starts_with ( "--user-dependencies" )
350+ !arg. starts_with ( "-MMD" )
351+ && !arg. starts_with ( "-MD" )
352+ && !arg. starts_with ( "--write-user-dependencies" )
353+ && !arg. starts_with ( "--user-dependencies" )
354354 } )
355355 . cloned ( )
356356 . collect :: < Vec < _ > > ( ) ;
@@ -819,8 +819,8 @@ impl Bindings {
819819 return false ;
820820 }
821821
822- if arg. starts_with ( "-I" ) ||
823- arg. starts_with ( "--include-directory=" )
822+ if arg. starts_with ( "-I" )
823+ || arg. starts_with ( "--include-directory=" )
824824 {
825825 return false ;
826826 }
@@ -845,8 +845,8 @@ impl Bindings {
845845 debug ! ( "Found clang: {clang:?}" ) ;
846846
847847 // Whether we are working with C or C++ inputs.
848- let is_cpp = args_are_cpp ( & options. clang_args ) ||
849- options. input_headers . iter ( ) . any ( |h| file_is_cpp ( h) ) ;
848+ let is_cpp = args_are_cpp ( & options. clang_args )
849+ || options. input_headers . iter ( ) . any ( |h| file_is_cpp ( h) ) ;
850850
851851 let search_paths = if is_cpp {
852852 clang. cpp_search_paths
@@ -927,17 +927,17 @@ impl Bindings {
927927
928928 /// Write these bindings as source text to a file.
929929 pub fn write_to_file < P : AsRef < Path > > ( & self , path : P ) -> io:: Result < ( ) > {
930- let file = OpenOptions :: new ( )
930+ let mut file = OpenOptions :: new ( )
931931 . write ( true )
932932 . truncate ( true )
933933 . create ( true )
934934 . open ( path. as_ref ( ) ) ?;
935- self . write ( Box :: new ( file) ) ?;
935+ self . write ( & mut file) ?;
936936 Ok ( ( ) )
937937 }
938938
939939 /// Write these bindings as source text to the given `Write`able.
940- pub fn write < ' a > ( & self , mut writer : Box < dyn Write + ' a > ) -> io:: Result < ( ) > {
940+ pub fn write ( & self , writer : & mut dyn Write ) -> io:: Result < ( ) > {
941941 const NL : & str = if cfg ! ( windows) { "\r \n " } else { "\n " } ;
942942
943943 if !self . options . disable_header_comment {
@@ -1090,7 +1090,7 @@ fn rustfmt_non_fatal_error_diagnostic(msg: &str, _options: &BindgenOptions) {
10901090impl std:: fmt:: Display for Bindings {
10911091 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
10921092 let mut bytes = vec ! [ ] ;
1093- self . write ( Box :: new ( & mut bytes) as Box < dyn Write > )
1093+ self . write ( & mut bytes)
10941094 . expect ( "writing to a vec cannot fail" ) ;
10951095 f. write_str (
10961096 std:: str:: from_utf8 ( & bytes)
0 commit comments