Skip to content

Commit

Permalink
Remove unnecessary clone in ReadDir
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-nitrokey committed Aug 16, 2024
1 parent 2d38157 commit 2fa8e94
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ pub struct ReadDir<'a, 'b, S: driver::Storage> {
// to the field alloc.state, so we cannot assert unique mutable access.
alloc: RefCell<*mut ReadDirAllocation>,
fs: &'b Filesystem<'a, S>,
path: PathBuf,
path: &'b Path,
}

impl<'a, 'b, S: driver::Storage> Iterator for ReadDir<'a, 'b, S> {
Expand Down Expand Up @@ -1008,7 +1008,7 @@ impl<'a, Storage: driver::Storage> Filesystem<'a, Storage> {
pub unsafe fn read_dir<'b>(
&'b self,
alloc: &'b mut ReadDirAllocation,
path: &Path,
path: &'b Path,
) -> Result<ReadDir<'a, 'b, Storage>> {
// ll::lfs_dir_open stores a copy of the pointer to alloc.state, so
// we must use addr_of_mut! here, since &mut alloc.state asserts unique
Expand All @@ -1022,7 +1022,7 @@ impl<'a, Storage: driver::Storage> Filesystem<'a, Storage> {
let read_dir = ReadDir {
alloc: RefCell::new(alloc),
fs: self,
path: PathBuf::from(path),
path,
};

result_from(read_dir, return_code)
Expand Down

0 comments on commit 2fa8e94

Please sign in to comment.