mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
review panic in InnerConnection.drop
This commit is contained in:
parent
0d1907887e
commit
ab643c90ce
15
src/lib.rs
15
src/lib.rs
@ -871,14 +871,17 @@ impl InnerConnection {
|
||||
}
|
||||
|
||||
impl Drop for InnerConnection {
|
||||
#[cfg(not(test))]
|
||||
#[allow(unused_must_use)]
|
||||
fn drop(&mut self) {
|
||||
self.close();
|
||||
}
|
||||
#[cfg(test)]
|
||||
fn drop(&mut self) {
|
||||
self.close().expect("Error while closing SQLite connection");
|
||||
use std::thread::panicking;
|
||||
|
||||
if let Err(e) = self.close() {
|
||||
if panicking() {
|
||||
eprintln!("Error while closing SQLite connection: {:?}", e);
|
||||
} else {
|
||||
panic!("Error while closing SQLite connection: {:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user