@@ -15,7 +15,7 @@ use std::{env, fs, io};
1515fn main ( ) {
1616 // Send GET request and inspect result, with proper error handling.
1717 if let Err ( e) = run_client ( ) {
18- eprintln ! ( "FAILED: {}" , e ) ;
18+ eprintln ! ( "FAILED: {e}" ) ;
1919 std:: process:: exit ( 1 ) ;
2020 }
2121}
@@ -34,7 +34,7 @@ async fn run_client() -> io::Result<()> {
3434
3535 // First parameter is target URL (mandatory).
3636 let url = match env:: args ( ) . nth ( 1 ) {
37- Some ( ref url) => Uri :: from_str ( url) . map_err ( |e| error ( format ! ( "{}" , e ) ) ) ?,
37+ Some ( ref url) => Uri :: from_str ( url) . map_err ( |e| error ( format ! ( "{e}" ) ) ) ?,
3838 None => {
3939 println ! ( "Usage: client <url> <ca_store>" ) ;
4040 return Ok ( ( ) ) ;
@@ -44,8 +44,8 @@ async fn run_client() -> io::Result<()> {
4444 // Second parameter is custom Root-CA store (optional, defaults to native cert store).
4545 let mut ca = match env:: args ( ) . nth ( 2 ) {
4646 Some ( ref path) => {
47- let f = fs :: File :: open ( path )
48- . map_err ( |e| error ( format ! ( "failed to open {}: {}" , path , e ) ) ) ?;
47+ let f =
48+ fs :: File :: open ( path ) . map_err ( |e| error ( format ! ( "failed to open {path }: {e}" ) ) ) ?;
4949 let rd = io:: BufReader :: new ( f) ;
5050 Some ( rd)
5151 }
@@ -86,15 +86,15 @@ async fn run_client() -> io::Result<()> {
8686 let res = client
8787 . get ( url)
8888 . await
89- . map_err ( |e| error ( format ! ( "Could not get: {:?}" , e ) ) ) ?;
89+ . map_err ( |e| error ( format ! ( "Could not get: {e :?}" ) ) ) ?;
9090 println ! ( "Status:\n {}" , res. status( ) ) ;
9191 println ! ( "Headers:\n {:#?}" , res. headers( ) ) ;
9292
9393 let body = res
9494 . into_body ( )
9595 . collect ( )
9696 . await
97- . map_err ( |e| error ( format ! ( "Could not get body: {:?}" , e ) ) ) ?
97+ . map_err ( |e| error ( format ! ( "Could not get body: {e :?}" ) ) ) ?
9898 . to_bytes ( ) ;
9999 println ! ( "Body:\n {}" , String :: from_utf8_lossy( & body) ) ;
100100
0 commit comments