@@ -338,8 +338,8 @@ impl Url {
338
338
///
339
339
/// [`ParseError`]: enum.ParseError.html
340
340
#[ inline]
341
- pub fn parse ( input : & str ) -> Result < Url , crate :: ParseError > {
342
- Url :: options ( ) . parse ( input)
341
+ pub fn parse ( input : & str ) -> Result < Self , crate :: ParseError > {
342
+ Self :: options ( ) . parse ( input)
343
343
}
344
344
345
345
/// Parse an absolute URL from a string and add params to its query string.
@@ -368,14 +368,14 @@ impl Url {
368
368
///
369
369
/// [`ParseError`]: enum.ParseError.html
370
370
#[ inline]
371
- pub fn parse_with_params < I , K , V > ( input : & str , iter : I ) -> Result < Url , crate :: ParseError >
371
+ pub fn parse_with_params < I , K , V > ( input : & str , iter : I ) -> Result < Self , crate :: ParseError >
372
372
where
373
373
I : IntoIterator ,
374
374
I :: Item : Borrow < ( K , V ) > ,
375
375
K : AsRef < str > ,
376
376
V : AsRef < str > ,
377
377
{
378
- let mut url = Url :: options ( ) . parse ( input) ;
378
+ let mut url = Self :: options ( ) . parse ( input) ;
379
379
380
380
if let Ok ( ref mut url) = url {
381
381
url. query_pairs_mut ( ) . extend_pairs ( iter) ;
@@ -468,8 +468,8 @@ impl Url {
468
468
/// [`ParseError`]: enum.ParseError.html
469
469
/// [`make_relative`]: #method.make_relative
470
470
#[ inline]
471
- pub fn join ( & self , input : & str ) -> Result < Url , crate :: ParseError > {
472
- Url :: options ( ) . base_url ( Some ( self ) ) . parse ( input)
471
+ pub fn join ( & self , input : & str ) -> Result < Self , crate :: ParseError > {
472
+ Self :: options ( ) . base_url ( Some ( self ) ) . parse ( input)
473
473
}
474
474
475
475
/// Creates a relative URL if possible, with this URL as the base URL.
@@ -513,7 +513,7 @@ impl Url {
513
513
/// This is for example the case if the scheme, host or port are not the same.
514
514
///
515
515
/// [`join`]: #method.join
516
- pub fn make_relative ( & self , url : & Url ) -> Option < String > {
516
+ pub fn make_relative ( & self , url : & Self ) -> Option < String > {
517
517
if self . cannot_be_a_base ( ) {
518
518
return None ;
519
519
}
@@ -789,7 +789,7 @@ impl Url {
789
789
assert ! ( fragment_start > query_start) ;
790
790
}
791
791
792
- let other = Url :: parse ( self . as_str ( ) ) . expect ( "Failed to parse myself?" ) ;
792
+ let other = Self :: parse ( self . as_str ( ) ) . expect ( "Failed to parse myself?" ) ;
793
793
assert_eq ! ( & self . serialization, & other. serialization) ;
794
794
assert_eq ! ( self . scheme_end, other. scheme_end) ;
795
795
assert_eq ! ( self . username_end, other. username_end) ;
@@ -2543,11 +2543,11 @@ impl Url {
2543
2543
)
2544
2544
) ) ]
2545
2545
#[ allow( clippy:: result_unit_err) ]
2546
- pub fn from_file_path < P : AsRef < std:: path:: Path > > ( path : P ) -> Result < Url , ( ) > {
2546
+ pub fn from_file_path < P : AsRef < std:: path:: Path > > ( path : P ) -> Result < Self , ( ) > {
2547
2547
let mut serialization = "file://" . to_owned ( ) ;
2548
2548
let host_start = serialization. len ( ) as u32 ;
2549
2549
let ( host_end, host) = path_to_file_url_segments ( path. as_ref ( ) , & mut serialization) ?;
2550
- Ok ( Url {
2550
+ Ok ( Self {
2551
2551
serialization,
2552
2552
scheme_end : "file" . len ( ) as u32 ,
2553
2553
username_end : host_start,
@@ -2591,8 +2591,8 @@ impl Url {
2591
2591
)
2592
2592
) ) ]
2593
2593
#[ allow( clippy:: result_unit_err) ]
2594
- pub fn from_directory_path < P : AsRef < std:: path:: Path > > ( path : P ) -> Result < Url , ( ) > {
2595
- let mut url = Url :: from_file_path ( path) ?;
2594
+ pub fn from_directory_path < P : AsRef < std:: path:: Path > > ( path : P ) -> Result < Self , ( ) > {
2595
+ let mut url = Self :: from_file_path ( path) ?;
2596
2596
if !url. serialization . ends_with ( '/' ) {
2597
2597
url. serialization . push ( '/' )
2598
2598
}
@@ -2771,16 +2771,16 @@ impl str::FromStr for Url {
2771
2771
type Err = ParseError ;
2772
2772
2773
2773
#[ inline]
2774
- fn from_str ( input : & str ) -> Result < Url , crate :: ParseError > {
2775
- Url :: parse ( input)
2774
+ fn from_str ( input : & str ) -> Result < Self , crate :: ParseError > {
2775
+ Self :: parse ( input)
2776
2776
}
2777
2777
}
2778
2778
2779
2779
impl < ' a > TryFrom < & ' a str > for Url {
2780
2780
type Error = ParseError ;
2781
2781
2782
2782
fn try_from ( s : & ' a str ) -> Result < Self , Self :: Error > {
2783
- Url :: parse ( s)
2783
+ Self :: parse ( s)
2784
2784
}
2785
2785
}
2786
2786
@@ -2794,7 +2794,7 @@ impl fmt::Display for Url {
2794
2794
2795
2795
/// String conversion.
2796
2796
impl From < Url > for String {
2797
- fn from ( value : Url ) -> String {
2797
+ fn from ( value : Url ) -> Self {
2798
2798
value. serialization
2799
2799
}
2800
2800
}
0 commit comments