File tree 1 file changed +22
-24
lines changed
1 file changed +22
-24
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,10 @@ use clap::{
14
14
CommandFactory , Parser ,
15
15
} ;
16
16
use proc_macro2:: TokenStream ;
17
- use std:: fs:: File ;
18
17
use std:: io;
19
18
use std:: path:: { Path , PathBuf } ;
20
- use std:: process:: exit;
21
19
use std:: str:: FromStr ;
20
+ use std:: { fs:: File , process:: exit} ;
22
21
23
22
fn rust_target_help ( ) -> String {
24
23
format ! (
@@ -649,28 +648,6 @@ where
649
648
clang_args,
650
649
} = command;
651
650
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
-
674
651
let mut builder = builder ( ) ;
675
652
676
653
#[ derive( Debug ) ]
@@ -822,6 +799,27 @@ where
822
799
823
800
builder = apply_args ! (
824
801
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
+ } ,
825
823
header,
826
824
rust_target,
827
825
default_enum_style,
You can’t perform that action at this time.
0 commit comments