From 609e3a633f8d5c66a32ee6be4283118c944b376f Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 12 Nov 2021 13:52:00 +0100 Subject: [PATCH] use #![deny(unsafe_op_in_unsafe_fn)] Signed-off-by: Wolfgang Bumiller --- src/accessor/aio.rs | 8 +++++--- src/accessor/sync.rs | 10 +++++----- src/lib.rs | 2 ++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/accessor/aio.rs b/src/accessor/aio.rs index ca5651c..5e7f531 100644 --- a/src/accessor/aio.rs +++ b/src/accessor/aio.rs @@ -125,7 +125,9 @@ impl Accessor { /// This should only be used with offsets known to point to the end of a directory, otherwise /// this usually fails, unless the data otherwise happens to look like a valid directory. pub async unsafe fn open_dir_at_end(&self, offset: u64) -> io::Result> { - Ok(Directory::new(self.inner.open_dir_at_end(offset).await?)) + Ok(Directory::new(unsafe { + self.inner.open_dir_at_end(offset).await? + })) } /// Allow opening a regular file from a specified range. @@ -139,7 +141,7 @@ impl Accessor { entry_range_info: &accessor::EntryRangeInfo, ) -> io::Result> { Ok(FileEntry { - inner: self.inner.open_file_at_range(entry_range_info).await?, + inner: unsafe { self.inner.open_file_at_range(entry_range_info).await? }, }) } @@ -151,7 +153,7 @@ impl Accessor { /// comes from a actual file entry data, the contents might not make much sense. pub unsafe fn open_contents_at_range(&self, range: Range) -> FileContents { FileContents { - inner: self.inner.open_contents_at_range(range), + inner: unsafe { self.inner.open_contents_at_range(range) }, at: 0, buffer: Vec::new(), future: None, diff --git a/src/accessor/sync.rs b/src/accessor/sync.rs index 5b8ada2..f61a13d 100644 --- a/src/accessor/sync.rs +++ b/src/accessor/sync.rs @@ -116,9 +116,9 @@ impl Accessor { /// This should only be used with offsets known to point to the end of a directory, otherwise /// this usually fails, unless the data otherwise happens to look like a valid directory. pub unsafe fn open_dir_at_end(&self, offset: u64) -> io::Result> { - Ok(Directory::new(poll_result_once( - self.inner.open_dir_at_end(offset), - )?)) + Ok(Directory::new(poll_result_once(unsafe { + self.inner.open_dir_at_end(offset) + })?)) } /// Allow opening a regular file from a specified range. @@ -132,7 +132,7 @@ impl Accessor { entry_range_info: &accessor::EntryRangeInfo, ) -> io::Result> { Ok(FileEntry { - inner: poll_result_once(self.inner.open_file_at_range(entry_range_info))?, + inner: poll_result_once(unsafe { self.inner.open_file_at_range(entry_range_info) })?, }) } @@ -144,7 +144,7 @@ impl Accessor { /// comes from a actual file entry data, the contents might not make much sense. pub unsafe fn open_contents_at_range(&self, range: Range) -> FileContents { FileContents { - inner: self.inner.open_contents_at_range(range), + inner: unsafe { self.inner.open_contents_at_range(range) }, at: 0, } } diff --git a/src/lib.rs b/src/lib.rs index 86a8d6e..c22b8da 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,8 @@ //! //! This implements a reader and writer for the proxmox archive format (.pxar). +#![deny(unsafe_op_in_unsafe_fn)] + use std::ffi::OsStr; use std::mem; use std::path::{Path, PathBuf};