@@ -164,15 +164,15 @@ use crate::host::HostInternal;
164164use crate :: parser:: {
165165 to_u32, Context , Parser , SchemeType , PATH_SEGMENT , SPECIAL_PATH_SEGMENT , USERINFO ,
166166} ;
167- use percent_encoding:: { percent_decode, percent_encode, utf8_percent_encode} ;
168167use core:: borrow:: Borrow ;
169168use core:: cmp;
170169use core:: fmt:: { self , Write } ;
171170use core:: hash;
172171use core:: mem;
173- use std_core_compat:: net:: IpAddr ;
174172use core:: ops:: { Range , RangeFrom , RangeTo } ;
175173use core:: str;
174+ use percent_encoding:: { percent_decode, percent_encode, utf8_percent_encode} ;
175+ use std_core_compat:: net:: IpAddr ;
176176
177177use alloc:: borrow:: ToOwned ;
178178use alloc:: format;
@@ -1291,13 +1291,16 @@ impl Url {
12911291 /// })
12921292 /// }
12931293 /// ```
1294- #[ cfg( all( feature = "std" , any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ) ]
1294+ #[ cfg( all(
1295+ feature = "std" ,
1296+ any( unix, windows, target_os = "redox" , target_os = "wasi" )
1297+ ) ) ]
12951298 pub fn socket_addrs (
12961299 & self ,
12971300 default_port_number : impl Fn ( ) -> Option < u16 > ,
12981301 ) -> std:: io:: Result < Vec < std:: net:: SocketAddr > > {
1299- use std:: net:: ToSocketAddrs ;
13001302 use std:: io;
1303+ use std:: net:: ToSocketAddrs ;
13011304 // Note: trying to avoid the Vec allocation by returning `impl AsRef<[SocketAddr]>`
13021305 // causes borrowck issues because the return value borrows `default_port_number`:
13031306 //
@@ -2483,7 +2486,10 @@ impl Url {
24832486 /// # run().unwrap();
24842487 /// # }
24852488 /// ```
2486- #[ cfg( all( feature = "std" , any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ) ]
2489+ #[ cfg( all(
2490+ feature = "std" ,
2491+ any( unix, windows, target_os = "redox" , target_os = "wasi" )
2492+ ) ) ]
24872493 #[ allow( clippy:: result_unit_err) ]
24882494 pub fn from_file_path < P : AsRef < std:: path:: Path > > ( path : P ) -> Result < Url , ( ) > {
24892495 let mut serialization = "file://" . to_owned ( ) ;
@@ -2520,7 +2526,10 @@ impl Url {
25202526 ///
25212527 /// Note that `std::path` does not consider trailing slashes significant
25222528 /// and usually does not include them (e.g. in `Path::parent()`).
2523- #[ cfg( all( feature = "std" , any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ) ]
2529+ #[ cfg( all(
2530+ feature = "std" ,
2531+ any( unix, windows, target_os = "redox" , target_os = "wasi" )
2532+ ) ) ]
25242533 #[ allow( clippy:: result_unit_err) ]
25252534 pub fn from_directory_path < P : AsRef < std:: path:: Path > > ( path : P ) -> Result < Url , ( ) > {
25262535 let mut url = Url :: from_file_path ( path) ?;
@@ -2637,7 +2646,10 @@ impl Url {
26372646 /// (That is, if the percent-decoded path contains a NUL byte or,
26382647 /// for a Windows path, is not UTF-8.)
26392648 #[ inline]
2640- #[ cfg( all( feature = "std" , any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ) ]
2649+ #[ cfg( all(
2650+ feature = "std" ,
2651+ any( unix, windows, target_os = "redox" , target_os = "wasi" )
2652+ ) ) ]
26412653 #[ allow( clippy:: result_unit_err) ]
26422654 pub fn to_file_path ( & self ) -> Result < std:: path:: PathBuf , ( ) > {
26432655 if let Some ( segments) = self . path_segments ( ) {
@@ -2950,11 +2962,11 @@ fn file_url_segments_to_pathbuf(
29502962 segments : str:: Split < ' _ , char > ,
29512963) -> Result < std:: path:: PathBuf , ( ) > {
29522964 use std:: ffi:: OsStr ;
2953- use std:: path:: PathBuf ;
29542965 #[ cfg( any( unix, target_os = "redox" ) ) ]
29552966 use std:: os:: unix:: prelude:: OsStrExt ;
29562967 #[ cfg( target_os = "wasi" ) ]
29572968 use std:: os:: wasi:: prelude:: OsStrExt ;
2969+ use std:: path:: PathBuf ;
29582970
29592971 if host. is_some ( ) {
29602972 return Err ( ( ) ) ;
0 commit comments