@@ -978,17 +978,17 @@ impl Bindings {
978
978
}
979
979
980
980
/// Gets the rustfmt path to rustfmt the generated bindings.
981
- fn rustfmt_path ( & self ) -> io :: Result < Cow < ' _ , Path > > {
981
+ fn rustfmt_path ( & self ) -> Cow < ' _ , Path > {
982
982
debug_assert ! ( matches!( self . options. formatter, Formatter :: Rustfmt ) ) ;
983
983
if let Some ( ref p) = self . options . rustfmt_path {
984
- return Ok ( Cow :: Borrowed ( p) ) ;
985
- }
986
- if let Ok ( rustfmt) = env:: var ( "RUSTFMT" ) {
987
- return Ok ( Cow :: Owned ( rustfmt. into ( ) ) ) ;
984
+ Cow :: Borrowed ( p)
985
+ } else if let Ok ( rustfmt) = env:: var ( "RUSTFMT" ) {
986
+ Cow :: Owned ( rustfmt. into ( ) )
987
+ } else {
988
+ // No rustfmt binary was specified, so assume that the binary is called
989
+ // "rustfmt" and that it is in the user's PATH.
990
+ Cow :: Borrowed ( Path :: new ( "rustfmt" ) )
988
991
}
989
- // No rustfmt binary was specified, so assume that the binary is called
990
- // "rustfmt" and that it is in the user's PATH.
991
- Ok ( Cow :: Owned ( "rustfmt" . into ( ) ) )
992
992
}
993
993
994
994
/// Formats a token stream with the formatter set up in `BindgenOptions`.
@@ -1008,7 +1008,7 @@ impl Bindings {
1008
1008
Formatter :: Rustfmt => ( ) ,
1009
1009
}
1010
1010
1011
- let rustfmt = self . rustfmt_path ( ) ? ;
1011
+ let rustfmt = self . rustfmt_path ( ) ;
1012
1012
let mut cmd = Command :: new ( & * rustfmt) ;
1013
1013
1014
1014
cmd. stdin ( Stdio :: piped ( ) ) . stdout ( Stdio :: piped ( ) ) ;
0 commit comments