Skip to content

Commit c34f224

Browse files
authored
Merge pull request #686 from dtantsur/into-string
url: deprecate into_string for Into<String> (fixes #685)
2 parents d530255 + fc54ffd commit c34f224

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

url/src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,14 +417,15 @@ impl Url {
417417
/// # fn run() -> Result<(), ParseError> {
418418
/// let url_str = "https://example.net/";
419419
/// let url = Url::parse(url_str)?;
420-
/// assert_eq!(url.into_string(), url_str);
420+
/// assert_eq!(String::from(url), url_str);
421421
/// # Ok(())
422422
/// # }
423423
/// # run().unwrap();
424424
/// ```
425425
#[inline]
426+
#[deprecated(since = "2.3.0", note = "use Into<String>")]
426427
pub fn into_string(self) -> String {
427-
self.serialization
428+
self.into()
428429
}
429430

430431
/// For internal testing, not part of the public API.
@@ -2375,6 +2376,13 @@ impl fmt::Display for Url {
23752376
}
23762377
}
23772378

2379+
/// String converstion.
2380+
impl From<Url> for String {
2381+
fn from(value: Url) -> String {
2382+
value.serialization
2383+
}
2384+
}
2385+
23782386
/// Debug the serialization of this URL.
23792387
impl fmt::Debug for Url {
23802388
#[inline]

0 commit comments

Comments
 (0)