@@ -18,7 +18,7 @@ use crate::ops;
1818use crate :: sources:: git;
1919use crate :: sources:: DirectorySource ;
2020use crate :: sources:: { GitSource , PathSource , RegistrySource , CRATES_IO_INDEX } ;
21- use crate :: util:: { CargoResult , Config , ToUrl } ;
21+ use crate :: util:: { CargoResult , Config , IntoUrl } ;
2222
2323lazy_static:: lazy_static! {
2424 static ref SOURCE_ID_CACHE : Mutex <HashSet <& ' static SourceIdInner >> = Mutex :: new( HashSet :: new( ) ) ;
@@ -117,7 +117,7 @@ impl SourceId {
117117
118118 match kind {
119119 "git" => {
120- let mut url = url. to_url ( ) ?;
120+ let mut url = url. into_url ( ) ?;
121121 let mut reference = GitReference :: Branch ( "master" . to_string ( ) ) ;
122122 for ( k, v) in url. query_pairs ( ) {
123123 match & k[ ..] {
@@ -135,11 +135,11 @@ impl SourceId {
135135 Ok ( SourceId :: for_git ( & url, reference) ?. with_precise ( precise) )
136136 }
137137 "registry" => {
138- let url = url. to_url ( ) ?;
138+ let url = url. into_url ( ) ?;
139139 Ok ( SourceId :: new ( Kind :: Registry , url) ?. with_precise ( Some ( "locked" . to_string ( ) ) ) )
140140 }
141141 "path" => {
142- let url = url. to_url ( ) ?;
142+ let url = url. into_url ( ) ?;
143143 SourceId :: new ( Kind :: Path , url)
144144 }
145145 kind => Err ( failure:: format_err!(
@@ -150,8 +150,8 @@ impl SourceId {
150150 }
151151
152152 /// A view of the `SourceId` that can be `Display`ed as a URL.
153- pub fn to_url ( & self ) -> SourceIdToUrl < ' _ > {
154- SourceIdToUrl {
153+ pub fn into_url ( & self ) -> SourceIdIntoUrl < ' _ > {
154+ SourceIdIntoUrl {
155155 inner : & * self . inner ,
156156 }
157157 }
@@ -160,7 +160,7 @@ impl SourceId {
160160 ///
161161 /// `path`: an absolute path.
162162 pub fn for_path ( path : & Path ) -> CargoResult < SourceId > {
163- let url = path. to_url ( ) ?;
163+ let url = path. into_url ( ) ?;
164164 SourceId :: new ( Kind :: Path , url)
165165 }
166166
@@ -176,13 +176,13 @@ impl SourceId {
176176
177177 /// Creates a SourceId from a local registry path.
178178 pub fn for_local_registry ( path : & Path ) -> CargoResult < SourceId > {
179- let url = path. to_url ( ) ?;
179+ let url = path. into_url ( ) ?;
180180 SourceId :: new ( Kind :: LocalRegistry , url)
181181 }
182182
183183 /// Creates a `SourceId` from a directory path.
184184 pub fn for_directory ( path : & Path ) -> CargoResult < SourceId > {
185- let url = path. to_url ( ) ?;
185+ let url = path. into_url ( ) ?;
186186 SourceId :: new ( Kind :: Directory , url)
187187 }
188188
@@ -207,7 +207,7 @@ impl SourceId {
207207 } else {
208208 CRATES_IO_INDEX
209209 } ;
210- let url = url. to_url ( ) ?;
210+ let url = url. into_url ( ) ?;
211211 SourceId :: for_registry ( & url)
212212 } )
213213 }
@@ -390,7 +390,7 @@ impl ser::Serialize for SourceId {
390390 if self . is_path ( ) {
391391 None :: < String > . serialize ( s)
392392 } else {
393- s. collect_str ( & self . to_url ( ) )
393+ s. collect_str ( & self . into_url ( ) )
394394 }
395395 }
396396}
@@ -504,11 +504,11 @@ impl Hash for SourceId {
504504}
505505
506506/// A `Display`able view into a `SourceId` that will write it as a url
507- pub struct SourceIdToUrl < ' a > {
507+ pub struct SourceIdIntoUrl < ' a > {
508508 inner : & ' a SourceIdInner ,
509509}
510510
511- impl < ' a > fmt:: Display for SourceIdToUrl < ' a > {
511+ impl < ' a > fmt:: Display for SourceIdIntoUrl < ' a > {
512512 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
513513 match * self . inner {
514514 SourceIdInner {
@@ -579,15 +579,15 @@ impl<'a> fmt::Display for PrettyRef<'a> {
579579#[ cfg( test) ]
580580mod tests {
581581 use super :: { GitReference , Kind , SourceId } ;
582- use crate :: util:: ToUrl ;
582+ use crate :: util:: IntoUrl ;
583583
584584 #[ test]
585585 fn github_sources_equal ( ) {
586- let loc = "https://github.com/foo/bar" . to_url ( ) . unwrap ( ) ;
586+ let loc = "https://github.com/foo/bar" . into_url ( ) . unwrap ( ) ;
587587 let master = Kind :: Git ( GitReference :: Branch ( "master" . to_string ( ) ) ) ;
588588 let s1 = SourceId :: new ( master. clone ( ) , loc) . unwrap ( ) ;
589589
590- let loc = "git://github.com/foo/bar" . to_url ( ) . unwrap ( ) ;
590+ let loc = "git://github.com/foo/bar" . into_url ( ) . unwrap ( ) ;
591591 let s2 = SourceId :: new ( master, loc. clone ( ) ) . unwrap ( ) ;
592592
593593 assert_eq ! ( s1, s2) ;
0 commit comments