@@ -65,9 +65,9 @@ impl Url {
6565 // query and fragment
6666 let ( query, fragment) = try!( get_query_fragment ( rest) ) ;
6767
68- let url = Url :: new ( scheme. to_string ( ) ,
68+ let url = Url :: new ( scheme. to_owned ( ) ,
6969 userinfo,
70- host. to_string ( ) ,
70+ host. to_owned ( ) ,
7171 port,
7272 path,
7373 query,
@@ -180,22 +180,22 @@ pub fn get_scheme(rawurl: &str) -> DecodeResult<(&str, &str)> {
180180 '0' ... '9' | '+' | '-' | '.' => {
181181 if i != 0 { continue }
182182
183- Err ( "url: Scheme must begin with a letter." . to_string ( ) )
183+ Err ( "url: Scheme must begin with a letter." . to_owned ( ) )
184184 }
185185 ':' => {
186186 if i == 0 {
187- Err ( "url: Scheme cannot be empty." . to_string ( ) )
187+ Err ( "url: Scheme cannot be empty." . to_owned ( ) )
188188 } else {
189189 Ok ( ( & rawurl[ 0 ..i] , & rawurl[ i+1 ..rawurl. len ( ) ] ) )
190190 }
191191 }
192- _ => Err ( "url: Invalid character in scheme." . to_string ( ) ) ,
192+ _ => Err ( "url: Invalid character in scheme." . to_owned ( ) ) ,
193193 } ;
194194
195195 return result;
196196 }
197197
198- Err ( "url: Scheme must be terminated with a colon." . to_string ( ) )
198+ Err ( "url: Scheme must be terminated with a colon." . to_owned ( ) )
199199}
200200
201201// returns userinfo, host, port, and unparsed part, or an error
@@ -255,7 +255,7 @@ fn get_authority(rawurl: &str) ->
255255 ':' | '@' | '?' | '#' | '/' => {
256256 // separators, don't change anything
257257 }
258- _ => return Err ( "Illegal character in authority" . to_string ( ) ) ,
258+ _ => return Err ( "Illegal character in authority" . to_owned ( ) ) ,
259259 }
260260
261261 // now process states
@@ -271,7 +271,7 @@ fn get_authority(rawurl: &str) ->
271271 // multiple colons means ipv6 address.
272272 if input == Input :: Unreserved {
273273 return Err (
274- "Illegal characters in IPv6 address." . to_string ( ) ) ;
274+ "Illegal characters in IPv6 address." . to_owned ( ) ) ;
275275 }
276276 st = State :: Ip6Host ;
277277 }
@@ -288,7 +288,7 @@ fn get_authority(rawurl: &str) ->
288288 }
289289 State :: Ip6Port => {
290290 if input == Input :: Unreserved {
291- return Err ( "Illegal characters in authority." . to_string ( ) ) ;
291+ return Err ( "Illegal characters in authority." . to_owned ( ) ) ;
292292 }
293293 st = State :: Ip6Host ;
294294 }
@@ -299,7 +299,7 @@ fn get_authority(rawurl: &str) ->
299299 st = State :: InPort ;
300300 }
301301 }
302- _ => return Err ( "Invalid ':' in authority." . to_string ( ) ) ,
302+ _ => return Err ( "Invalid ':' in authority." . to_owned ( ) ) ,
303303 }
304304 input = Input :: Digit ; // reset input class
305305 }
@@ -319,7 +319,7 @@ fn get_authority(rawurl: &str) ->
319319 userinfo = Some ( UserInfo :: new ( user, Some ( pass) ) ) ;
320320 st = State :: InHost ;
321321 }
322- _ => return Err ( "Invalid '@' in authority." . to_string ( ) ) ,
322+ _ => return Err ( "Invalid '@' in authority." . to_owned ( ) ) ,
323323 }
324324 begin = i+1 ;
325325 }
@@ -338,7 +338,7 @@ fn get_authority(rawurl: &str) ->
338338 State :: PassHostPort
339339 | State :: Ip6Port => {
340340 if input != Input :: Digit {
341- return Err ( "Non-digit characters in port." . to_string ( ) ) ;
341+ return Err ( "Non-digit characters in port." . to_owned ( ) ) ;
342342 }
343343 host = & rawurl[ begin..pos] ;
344344 port = Some ( & rawurl[ pos+1 ..end] ) ;
@@ -347,7 +347,7 @@ fn get_authority(rawurl: &str) ->
347347 | State :: InHost => host = & rawurl[ begin..end] ,
348348 State :: InPort => {
349349 if input != Input :: Digit {
350- return Err ( "Non-digit characters in port." . to_string ( ) ) ;
350+ return Err ( "Non-digit characters in port." . to_owned ( ) ) ;
351351 }
352352 port = Some ( & rawurl[ pos+1 ..end] ) ;
353353 }
@@ -384,13 +384,13 @@ fn get_path(rawurl: &str, is_authority: bool) -> DecodeResult<(String, &str)> {
384384 end = i;
385385 break ;
386386 }
387- _ => return Err ( "Invalid character in path." . to_string ( ) )
387+ _ => return Err ( "Invalid character in path." . to_owned ( ) )
388388 }
389389 }
390390
391391 if is_authority && end != 0 && !rawurl. starts_with ( "/" ) {
392392 Err ( "Non-empty path must begin with \
393- '/' in presence of authority.". to_string ( ) )
393+ '/' in presence of authority.". to_owned ( ) )
394394 } else {
395395 Ok ( ( try!( decode_component ( & rawurl[ 0 ..end] ) ) , & rawurl[ end..len] ) )
396396 }
0 commit comments