From d31a97811b94fa4403939c289eaf98eaca237b0e Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Thu, 31 Oct 2024 17:44:28 +1300 Subject: Suppress errors when flushing file and stream data File and stream data is flushed on drop, and if flushing fails a panic is thrown, which prints a crash message to the terminal. Since we can't do anything if the write fails, and because file and stream writes are approached with a best-effort attitude, we suppress the errors to prevent the user from seeing them and getting concerned. --- src/devices/file_device/buffered_file.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/devices/file_device') diff --git a/src/devices/file_device/buffered_file.rs b/src/devices/file_device/buffered_file.rs index 3487d54..f965950 100644 --- a/src/devices/file_device/buffered_file.rs +++ b/src/devices/file_device/buffered_file.rs @@ -112,7 +112,7 @@ impl BufferedFile { pub fn flush(&mut self) { if let AccessMode::Write(writer) = &mut self.file { - writer.flush().unwrap(); + let _ = writer.flush(); } } } -- cgit v1.2.3-70-g09d2