From d77e19f6b773410bff4320c9fc3b1259d3fec58b Mon Sep 17 00:00:00 2001 From: "Craig M. Brandenburg" Date: Tue, 25 Aug 2015 08:55:29 -0700 Subject: [PATCH] Panic on error in TempDir destructor This commit eliminates the silent squashing of most errors in the `TempDir` destructor. The `NotFound` error is still ignored. --- src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 51c8d76..ec2ece4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -116,7 +116,13 @@ impl TempDir { impl Drop for TempDir { fn drop(&mut self) { - let _ = self.cleanup_dir(); + match self.cleanup_dir() { + Ok(_) => (), + Err(e) => match e.kind() { + ErrorKind::NotFound => (), + _ => panic!(e), + } + } } }