@@ -72,18 +72,17 @@ fn parse_allowed_http_host_from_unschemed(text: &str) -> Result<AllowedHttpHost,
72
72
// Host name parsing is quite hairy (thanks, IPv6), so punt it off to the
73
73
// Url type which gets paid big bucks to do it properly. (But preserve the
74
74
// original un-URL-ified string for use in error messages.)
75
- let urlised = format ! ( "http://{}" , text ) ;
75
+ let urlised = format ! ( "http://{text}" ) ;
76
76
let fake_url = Url :: parse ( & urlised)
77
- . map_err ( |_| format ! ( "{} isn't a valid host or host:port string" , text ) ) ?;
77
+ . map_err ( |_| format ! ( "{text } isn't a valid host or host:port string" ) ) ?;
78
78
parse_allowed_http_host_from_http_url ( & fake_url, text)
79
79
}
80
80
81
81
fn parse_allowed_http_host_from_schemed ( text : & str ) -> Result < AllowedHttpHost , String > {
82
- let url =
83
- Url :: parse ( text) . map_err ( |e| format ! ( "{} isn't a valid HTTP host URL: {}" , text, e) ) ?;
82
+ let url = Url :: parse ( text) . map_err ( |e| format ! ( "{text} isn't a valid HTTP host URL: {e}" ) ) ?;
84
83
85
84
if !matches ! ( url. scheme( ) , "http" | "https" ) {
86
- return Err ( format ! ( "{} isn't a valid host or host:port string" , text ) ) ;
85
+ return Err ( format ! ( "{text } isn't a valid host or host:port string" ) ) ;
87
86
}
88
87
89
88
parse_allowed_http_host_from_http_url ( & url, text)
@@ -92,13 +91,12 @@ fn parse_allowed_http_host_from_schemed(text: &str) -> Result<AllowedHttpHost, S
92
91
fn parse_allowed_http_host_from_http_url ( url : & Url , text : & str ) -> Result < AllowedHttpHost , String > {
93
92
let host = url
94
93
. host_str ( )
95
- . ok_or_else ( || format ! ( "{} doesn't contain a host name" , text ) ) ?;
94
+ . ok_or_else ( || format ! ( "{text } doesn't contain a host name" ) ) ?;
96
95
97
96
let has_path = url. path ( ) . len ( ) > 1 ; // allow "/"
98
97
if has_path {
99
98
return Err ( format ! (
100
- "{} contains a path, should be host and optional port only" ,
101
- text
99
+ "{text} contains a path, should be host and optional port only"
102
100
) ) ;
103
101
}
104
102
0 commit comments