Use question mark approach also in IPC::read
authorunC0Rr
Wed, 21 Nov 2018 15:52:17 +0100
changeset 14282 1b8c889027a3
parent 14281 f0c0d2d217c3
child 14283 72e9d69a5e4d
Use question mark approach also in IPC::read
rust/lib-hedgewars-engine/src/ipc.rs
--- a/rust/lib-hedgewars-engine/src/ipc.rs	Wed Nov 21 15:49:16 2018 +0100
+++ b/rust/lib-hedgewars-engine/src/ipc.rs	Wed Nov 21 15:52:17 2018 +0100
@@ -32,13 +32,11 @@
 
 impl Read for IPC {
     fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
-        let result = self.out_buffer.as_ref().read(buf);
+        let read_bytes = self.out_buffer.as_ref().read(buf)?;
 
-        if let Ok(read_bytes) = result {
-            self.out_buffer.consume(read_bytes);
-        }
+        self.out_buffer.consume(read_bytes);
 
-        result
+        Ok(read_bytes)
     }
 }