diff --git a/src/fs.rs b/src/fs.rs index 02184fdbf..e3547485c 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -478,7 +478,7 @@ fn try_rewriting( .as_ref() .is_ok_and(|(_file_id, potential_update)| !potential_update.do_save) { - wunlink(&tmp_name); + let _ = wunlink(&tmp_name); } result } diff --git a/src/history/history.rs b/src/history/history.rs index aaf8949cd..8a98a5a36 100644 --- a/src/history/history.rs +++ b/src/history/history.rs @@ -831,7 +831,7 @@ fn clear(&mut self) { self.first_unwritten_new_item_index = 0; self.file_contents = None; if let Ok(Some(filename)) = self.history_file_path() { - wunlink(&filename); + let _ = wunlink(&filename); } self.clear_file_state(); } diff --git a/src/wutil/mod.rs b/src/wutil/mod.rs index a36d18cdf..955772d06 100644 --- a/src/wutil/mod.rs +++ b/src/wutil/mod.rs @@ -59,9 +59,9 @@ pub fn waccess(file_name: &wstr, mode: libc::c_int) -> libc::c_int { } /// Wide character version of unlink(). -pub fn wunlink(file_name: &wstr) -> libc::c_int { - let tmp = wcs2zstring(file_name); - unsafe { libc::unlink(tmp.as_ptr()) } +pub fn wunlink(file_name: &wstr) -> io::Result<()> { + let tmp = wcs2osstring(file_name); + fs::remove_file(tmp) } pub fn wperror(s: &wstr) {