Skip to content

Commit 4a93618

Browse files
committed
Make Debug impls less recursive
1 parent e41870a commit 4a93618

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

src/lib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,8 +1163,7 @@ pub struct Transaction<'conn> {
11631163

11641164
impl<'a> fmt::Debug for Transaction<'a> {
11651165
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
1166-
write!(fmt, "Transaction {{ connection: {:?}, commit: {:?}, depth: {:?} }}",
1167-
self.conn, self.commit.get(), self.depth)
1166+
write!(fmt, "Transaction {{ commit: {:?}, depth: {:?} }}", self.commit.get(), self.depth)
11681167
}
11691168
}
11701169

@@ -1295,9 +1294,7 @@ pub struct Statement<'conn> {
12951294
impl<'a> fmt::Debug for Statement<'a> {
12961295
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
12971296
write!(fmt,
1298-
"Statement {{ connection: {:?}, name: {:?}, parameter_types: {:?}, \
1299-
result_descriptions: {:?} }}",
1300-
self.conn,
1297+
"Statement {{ name: {:?}, parameter_types: {:?}, result_descriptions: {:?} }}",
13011298
self.name,
13021299
self.param_types,
13031300
self.result_desc)
@@ -1537,7 +1534,10 @@ pub struct Rows<'stmt> {
15371534

15381535
impl<'a> fmt::Debug for Rows<'a> {
15391536
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
1540-
write!(fmt, "Rows {{ statement: {:?}, remaining_rows: {:?} }}", self.stmt, self.data.len())
1537+
write!(fmt,
1538+
"Rows {{ result_descriptions: {:?}, remaining_rows: {:?} }}",
1539+
self.result_descriptions(),
1540+
self.data.len())
15411541
}
15421542
}
15431543

@@ -1714,9 +1714,8 @@ impl<'a, 'b> Drop for LazyRows<'a, 'b> {
17141714
impl<'a, 'b> fmt::Debug for LazyRows<'a, 'b> {
17151715
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
17161716
write!(fmt,
1717-
"LazyRows {{ statement: {:?}, name: {:?}, row_limit: {:?}, remaining_rows: {:?}, \
1717+
"LazyRows {{ name: {:?}, row_limit: {:?}, remaining_rows: {:?}, \
17181718
more_rows: {:?} }}",
1719-
self.result.stmt,
17201719
self.name,
17211720
self.row_limit,
17221721
self.result.data.len(),
@@ -1792,8 +1791,8 @@ pub struct CopyInStatement<'a> {
17921791

17931792
impl<'a> fmt::Debug for CopyInStatement<'a> {
17941793
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
1795-
write!(fmt, "CopyInStatement {{ connection: {:?}, name: {:?}, column_types: {:?} }}",
1796-
self.conn, self.name, self.column_types)
1794+
write!(fmt, "CopyInStatement {{ name: {:?}, column_types: {:?} }}",
1795+
self.name, self.column_types)
17971796
}
17981797
}
17991798

0 commit comments

Comments
 (0)