@@ -16,7 +16,7 @@ const WOLFSSL_URL: &str = "https://github.com/wolfSSL/wolfssl/archive/refs/tags/
1616/// Handles the main build process and exits with an error code if anything fails.
1717fn main ( ) {
1818 if let Err ( e) = run_build ( ) {
19- eprintln ! ( "Build failed: {}" , e ) ;
19+ eprintln ! ( "Build failed: {e}" ) ;
2020 std:: process:: exit ( 1 ) ;
2121 }
2222}
@@ -62,17 +62,12 @@ fn generate_bindings() -> Result<()> {
6262 . clang_arg ( format ! ( "-I{}/" , wolfssl_include_dir. to_str( ) . unwrap( ) ) )
6363 . parse_callbacks ( Box :: new ( bindgen:: CargoCallbacks :: new ( ) ) )
6464 . generate ( )
65- . map_err ( |_| io:: Error :: new ( io :: ErrorKind :: Other , "Failed to generate bindings" ) ) ?;
65+ . map_err ( |_| io:: Error :: other ( "Failed to generate bindings" ) ) ?;
6666
6767 let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
6868 bindings
6969 . write_to_file ( out_path. join ( "bindings.rs" ) )
70- . map_err ( |e| {
71- io:: Error :: new (
72- io:: ErrorKind :: Other ,
73- format ! ( "Couldn't write bindings: {}" , e) ,
74- )
75- } )
70+ . map_err ( |e| io:: Error :: other ( format ! ( "Couldn't write bindings: {e}" ) ) )
7671}
7772
7873/// Coordinates the complete setup process for WolfSSL.
@@ -109,13 +104,10 @@ fn download_wolfssl() -> Result<()> {
109104 . output ( ) ?;
110105
111106 if !output. status . success ( ) {
112- return Err ( io:: Error :: new (
113- io:: ErrorKind :: Other ,
114- format ! (
115- "Failed to download: {}" ,
116- String :: from_utf8_lossy( & output. stderr)
117- ) ,
118- ) ) ;
107+ return Err ( io:: Error :: other ( format ! (
108+ "Failed to download: {}" ,
109+ String :: from_utf8_lossy( & output. stderr)
110+ ) ) ) ;
119111 }
120112 println ! ( "Download completed successfully." ) ;
121113 Ok ( ( ) )
@@ -131,13 +123,10 @@ fn unzip_wolfssl() -> Result<()> {
131123 let output = Command :: new ( "unzip" ) . arg ( WOLFSSL_ZIP ) . output ( ) ?;
132124
133125 if !output. status . success ( ) {
134- return Err ( io:: Error :: new (
135- io:: ErrorKind :: Other ,
136- format ! (
137- "Failed to unzip: {}" ,
138- String :: from_utf8_lossy( & output. stderr)
139- ) ,
140- ) ) ;
126+ return Err ( io:: Error :: other ( format ! (
127+ "Failed to unzip: {}" ,
128+ String :: from_utf8_lossy( & output. stderr)
129+ ) ) ) ;
141130 }
142131 println ! ( "Unzipping completed successfully." ) ;
143132 Ok ( ( ) )
@@ -166,7 +155,7 @@ fn remove_zip() -> Result<()> {
166155/// Returns `Ok(())` if all build steps succeed, or an error if any step fails.
167156fn build_wolfssl ( ) -> Result < ( ) > {
168157 env:: set_current_dir ( WOLFSSL_DIR ) ?;
169- println ! ( "Changed directory to {}." , WOLFSSL_DIR ) ;
158+ println ! ( "Changed directory to {WOLFSSL_DIR }." ) ;
170159
171160 run_command ( "./autogen.sh" , & [ ] ) ?;
172161 run_command (
@@ -198,16 +187,13 @@ fn run_command(cmd: &str, args: &[&str]) -> Result<()> {
198187 let output = Command :: new ( cmd) . args ( args) . output ( ) ?;
199188
200189 if !output. status . success ( ) {
201- return Err ( io:: Error :: new (
202- io:: ErrorKind :: Other ,
203- format ! (
204- "Failed to execute {}: {}" ,
205- cmd,
206- String :: from_utf8_lossy( & output. stderr)
207- ) ,
208- ) ) ;
190+ return Err ( io:: Error :: other ( format ! (
191+ "Failed to execute {}: {}" ,
192+ cmd,
193+ String :: from_utf8_lossy( & output. stderr)
194+ ) ) ) ;
209195 }
210- println ! ( "{} completed successfully." , cmd ) ;
196+ println ! ( "{cmd } completed successfully." ) ;
211197 Ok ( ( ) )
212198}
213199
0 commit comments