File tree Expand file tree Collapse file tree 1 file changed +22
-24
lines changed Expand file tree Collapse file tree 1 file changed +22
-24
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,10 @@ use clap::{
1414 CommandFactory , Parser ,
1515} ;
1616use proc_macro2:: TokenStream ;
17- use std:: fs:: File ;
1817use std:: io;
1918use std:: path:: { Path , PathBuf } ;
20- use std:: process:: exit;
2119use std:: str:: FromStr ;
20+ use std:: { fs:: File , process:: exit} ;
2221
2322fn rust_target_help ( ) -> String {
2423 format ! (
@@ -649,28 +648,6 @@ where
649648 clang_args,
650649 } = command;
651650
652- if let Some ( shell) = generate_shell_completions {
653- clap_complete:: generate (
654- shell,
655- & mut BindgenCommand :: command ( ) ,
656- "bindgen" ,
657- & mut std:: io:: stdout ( ) ,
658- ) ;
659-
660- exit ( 0 ) ;
661- }
662-
663- if version {
664- println ! (
665- "bindgen {}" ,
666- option_env!( "CARGO_PKG_VERSION" ) . unwrap_or( "unknown" )
667- ) ;
668- if verbose {
669- println ! ( "Clang: {}" , crate :: clang_version( ) . full) ;
670- }
671- std:: process:: exit ( 0 ) ;
672- }
673-
674651 let mut builder = builder ( ) ;
675652
676653 #[ derive( Debug ) ]
@@ -822,6 +799,27 @@ where
822799
823800 builder = apply_args ! (
824801 builder {
802+ generate_shell_completions => |_, shell| {
803+ clap_complete:: generate(
804+ shell,
805+ & mut BindgenCommand :: command( ) ,
806+ "bindgen" ,
807+ & mut std:: io:: stdout( ) ,
808+ ) ;
809+
810+ exit( 0 )
811+ } ,
812+ version => |_, _| {
813+ println!(
814+ "bindgen {}" ,
815+ option_env!( "CARGO_PKG_VERSION" ) . unwrap_or( "unknown" )
816+ ) ;
817+ if verbose {
818+ println!( "Clang: {}" , crate :: clang_version( ) . full) ;
819+ }
820+
821+ exit( 0 )
822+ } ,
825823 header,
826824 rust_target,
827825 default_enum_style,
You can’t perform that action at this time.
0 commit comments