@@ -72,18 +72,17 @@ fn parse_allowed_http_host_from_unschemed(text: &str) -> Result<AllowedHttpHost,
7272 // Host name parsing is quite hairy (thanks, IPv6), so punt it off to the
7373 // Url type which gets paid big bucks to do it properly. (But preserve the
7474 // original un-URL-ified string for use in error messages.)
75- let urlised = format ! ( "http://{}" , text ) ;
75+ let urlised = format ! ( "http://{text}" ) ;
7676 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" ) ) ?;
7878 parse_allowed_http_host_from_http_url ( & fake_url, text)
7979}
8080
8181fn 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}" ) ) ?;
8483
8584 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" ) ) ;
8786 }
8887
8988 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
9291fn parse_allowed_http_host_from_http_url ( url : & Url , text : & str ) -> Result < AllowedHttpHost , String > {
9392 let host = url
9493 . 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" ) ) ?;
9695
9796 let has_path = url. path ( ) . len ( ) > 1 ; // allow "/"
9897 if has_path {
9998 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"
102100 ) ) ;
103101 }
104102
0 commit comments