Skip to content

Commit 48501cf

Browse files
committed
Stop failing in destructors
I'm not sure what the right thing to do is here, but ignoring errors is what the standard library does.
1 parent f4c3664 commit 48501cf

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

src/lib.rs

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,6 @@ macro_rules! check_desync(
190190
)
191191
)
192192

193-
macro_rules! fail_unless_failing(
194-
($($t:tt)*) => (
195-
if !task::failing() {
196-
fail!($($t)*)
197-
}
198-
)
199-
)
200-
201193
pub mod error;
202194
pub mod pool;
203195
mod message;
@@ -405,11 +397,7 @@ struct InnerPostgresConnection {
405397
impl Drop for InnerPostgresConnection {
406398
fn drop(&mut self) {
407399
if !self.finished {
408-
match self.finish_inner() {
409-
Ok(()) | Err(PgStreamDesynchronized) => {}
410-
Err(err) =>
411-
fail_unless_failing!("Error dropping connection: {}", err)
412-
}
400+
let _ = self.finish_inner();
413401
}
414402
}
415403
}
@@ -886,11 +874,7 @@ pub struct PostgresTransaction<'conn> {
886874
impl<'conn> Drop for PostgresTransaction<'conn> {
887875
fn drop(&mut self) {
888876
if !self.finished {
889-
match self.finish_inner() {
890-
Ok(()) | Err(PgStreamDesynchronized) => {}
891-
Err(err) =>
892-
fail_unless_failing!("Error dropping transaction: {}", err)
893-
}
877+
let _ = self.finish_inner();
894878
}
895879
}
896880
}
@@ -1013,11 +997,7 @@ pub struct PostgresStatement<'conn> {
1013997
impl<'conn> Drop for PostgresStatement<'conn> {
1014998
fn drop(&mut self) {
1015999
if !self.finished.get() {
1016-
match self.finish_inner() {
1017-
Ok(()) | Err(PgStreamDesynchronized) => {}
1018-
Err(err) =>
1019-
fail_unless_failing!("Error dropping statement: {}", err)
1020-
}
1000+
let _ = self.finish_inner();
10211001
}
10221002
}
10231003
}
@@ -1227,11 +1207,7 @@ pub struct PostgresRows<'stmt> {
12271207
impl<'stmt> Drop for PostgresRows<'stmt> {
12281208
fn drop(&mut self) {
12291209
if !self.finished {
1230-
match self.finish_inner() {
1231-
Ok(()) | Err(PgStreamDesynchronized) => {}
1232-
Err(err) =>
1233-
fail_unless_failing!("Error dropping result: {}", err)
1234-
}
1210+
let _ = self.finish_inner();
12351211
}
12361212
}
12371213
}

0 commit comments

Comments
 (0)