diff options
Diffstat (limited to 'ripple/fossil/src')
-rw-r--r-- | ripple/fossil/src/bin/mount.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/ripple/fossil/src/bin/mount.rs b/ripple/fossil/src/bin/mount.rs index ee46b8e..f1bcdde 100644 --- a/ripple/fossil/src/bin/mount.rs +++ b/ripple/fossil/src/bin/mount.rs @@ -388,23 +388,23 @@ impl fuser::Filesystem for Filesystem { } }; - let mut children = vec![ - (ino, fuser::FileType::Directory, "."), - (ino, fuser::FileType::Directory, ".."), - ]; - - for entry in dir.iter() { + let children = dir.iter().map(|entry| { let kind = match entry.node() { memtree::Node::Directory(_) => fuser::FileType::Directory, memtree::Node::File(_) => fuser::FileType::RegularFile, memtree::Node::Link { .. } => fuser::FileType::Symlink, }; - children.push((ino + entry.index as u64 + 1, kind, &entry.name)); - } + (ino + entry.index as u64 + 1, kind, entry.name.as_str()) + }); + + let children = [ + (ino, fuser::FileType::Directory, "."), + (ino, fuser::FileType::Directory, ".."), + ] + .into_iter() + .chain(children); - for (offset, &(ino, kind, name)) in - children.iter().enumerate().skip(offset as usize) - { + for (offset, (ino, kind, name)) in children.enumerate().skip(offset as usize) { if reply.add(ino, (offset + 1) as i64, kind, name) { break; } |