feat(tvix/castore/fs): borrow some matches

We only do things with the reference, so we don't need to locally borrow
it.

Change-Id: I6073f7ec7aff717ae3069e28a00b1cb408a50ceb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10455
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
Florian Klink 2023-12-28 00:08:07 +01:00 committed by clbot
parent 5e3683cd53
commit 8a52c7f1c5

View file

@ -235,7 +235,7 @@ where
// the root node doesn't exist, so the file doesn't exist.
Ok(None) => Err(io::Error::from_raw_os_error(libc::ENOENT)),
// The root node does exist
Ok(Some(root_node)) => {
Ok(Some(ref root_node)) => {
// The name must match what's passed in the lookup, otherwise this is also a ENOENT.
if root_node.get_name() != name.to_bytes() {
debug!(root_node.name=?root_node.get_name(), found_node.name=%name.to_string_lossy(), "node name mismatch");
@ -258,7 +258,7 @@ where
// insert the (sparse) inode data and register in
// self.root_nodes.
let inode_data: InodeData = (&root_node).into();
let inode_data: InodeData = root_node.into();
let ino = inode_tracker.put(inode_data.clone());
root_nodes.insert(name.to_bytes().into(), ino);
@ -391,7 +391,7 @@ where
}
});
while let Some((i, root_node)) = rx.blocking_recv() {
while let Some((i, ref root_node)) = rx.blocking_recv() {
let root_node = match root_node {
Err(e) => {
warn!("failed to retrieve pathinfo: {}", e);
@ -405,7 +405,7 @@ where
let ino = self.get_inode_for_root_name(name).unwrap_or_else(|| {
// insert the (sparse) inode data and register in
// self.root_nodes.
let ino = self.inode_tracker.write().put((&root_node).into());
let ino = self.inode_tracker.write().put(root_node.into());
self.root_nodes.write().insert(name.into(), ino);
ino
});