@@ -15,7 +15,7 @@ use std::{env, fs, io};
15
15
fn main ( ) {
16
16
// Send GET request and inspect result, with proper error handling.
17
17
if let Err ( e) = run_client ( ) {
18
- eprintln ! ( "FAILED: {}" , e ) ;
18
+ eprintln ! ( "FAILED: {e}" ) ;
19
19
std:: process:: exit ( 1 ) ;
20
20
}
21
21
}
@@ -34,7 +34,7 @@ async fn run_client() -> io::Result<()> {
34
34
35
35
// First parameter is target URL (mandatory).
36
36
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}" ) ) ) ?,
38
38
None => {
39
39
println ! ( "Usage: client <url> <ca_store>" ) ;
40
40
return Ok ( ( ) ) ;
@@ -44,8 +44,8 @@ async fn run_client() -> io::Result<()> {
44
44
// Second parameter is custom Root-CA store (optional, defaults to native cert store).
45
45
let mut ca = match env:: args ( ) . nth ( 2 ) {
46
46
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}" ) ) ) ?;
49
49
let rd = io:: BufReader :: new ( f) ;
50
50
Some ( rd)
51
51
}
@@ -86,15 +86,15 @@ async fn run_client() -> io::Result<()> {
86
86
let res = client
87
87
. get ( url)
88
88
. await
89
- . map_err ( |e| error ( format ! ( "Could not get: {:?}" , e ) ) ) ?;
89
+ . map_err ( |e| error ( format ! ( "Could not get: {e :?}" ) ) ) ?;
90
90
println ! ( "Status:\n {}" , res. status( ) ) ;
91
91
println ! ( "Headers:\n {:#?}" , res. headers( ) ) ;
92
92
93
93
let body = res
94
94
. into_body ( )
95
95
. collect ( )
96
96
. await
97
- . map_err ( |e| error ( format ! ( "Could not get body: {:?}" , e ) ) ) ?
97
+ . map_err ( |e| error ( format ! ( "Could not get body: {e :?}" ) ) ) ?
98
98
. to_bytes ( ) ;
99
99
println ! ( "Body:\n {}" , String :: from_utf8_lossy( & body) ) ;
100
100
0 commit comments