From 376bf3a982d28d94d56d6131f51e8422760c7120 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 29 Dec 2024 14:29:52 +0100 Subject: [PATCH] Remove redundant return value from write_loop() This function ought to match the standard write_all(). --- src/common.rs | 6 ++---- src/env_universal_common.rs | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/common.rs b/src/common.rs index 213723ffb..db5691c46 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1369,9 +1369,7 @@ pub fn valid_func_name(name: &wstr) -> bool { /// A rusty port of the C++ `write_loop()` function from `common.cpp`. This should be deprecated in /// favor of native rust read/write methods at some point. -/// -/// Returns the number of bytes written or an IO error. -pub fn write_loop(fd: &Fd, buf: &[u8]) -> std::io::Result { +pub fn write_loop(fd: &Fd, buf: &[u8]) -> std::io::Result<()> { let fd = fd.as_raw_fd(); let mut total = 0; while total < buf.len() { @@ -1387,7 +1385,7 @@ pub fn write_loop(fd: &Fd, buf: &[u8]) -> std::io::Result { } } } - Ok(total) + Ok(()) } /// A rusty port of the C++ `read_loop()` function from `common.cpp`. This should be deprecated in diff --git a/src/env_universal_common.rs b/src/env_universal_common.rs index 8ee9d8466..ab343a9ab 100644 --- a/src/env_universal_common.rs +++ b/src/env_universal_common.rs @@ -522,13 +522,13 @@ impl EnvUniversal { } /// Writes our state to the fd. path is provided only for error reporting. - fn write_to_fd(&mut self, fd: impl AsFd, path: &wstr) -> std::io::Result { + fn write_to_fd(&mut self, fd: impl AsFd, path: &wstr) -> std::io::Result<()> { let fd = fd.as_fd(); let contents = Self::serialize_with_vars(&self.vars); let res = write_loop(&fd, &contents); match res.as_ref() { - Ok(_) => { + Ok(()) => { // Since we just wrote out this file, it matches our internal state; pretend we read from it. self.last_read_file = file_id_for_fd(fd); }