Skip to content

Commit 5267062

Browse files
authored
Show components in Url's Debug implementation (#637)
* Implement Debug for Url. * Fix formatting and clippy.
1 parent 7b8b841 commit 5267062

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
@@ -2350,8 +2350,16 @@ impl fmt::Display for Url {
23502350
/// Debug the serialization of this URL.
23512351
impl fmt::Debug for Url {
23522352
#[inline]
2353-
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
2354-
fmt::Debug::fmt(&self.serialization, formatter)
2353+
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
2354+
formatter
2355+
.debug_struct("Url")
2356+
.field("scheme", &self.scheme())
2357+
.field("host", &self.host())
2358+
.field("port", &self.port())
2359+
.field("path", &self.path())
2360+
.field("query", &self.query())
2361+
.field("fragment", &self.fragment())
2362+
.finish()
23552363
}
23562364
}
23572365

0 commit comments

Comments
 (0)