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 Sep 13, 2024
1 parent 69ff974 commit e225f06
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 @@ -923,7 +923,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 @@ -1012,7 +1012,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 @@ -1026,7 +1026,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 e225f06

Please sign in to comment.