diff --git a/yama/src/bin/yama.rs b/yama/src/bin/yama.rs index 8564f34..1d707dc 100644 --- a/yama/src/bin/yama.rs +++ b/yama/src/bin/yama.rs @@ -140,7 +140,7 @@ fn wrapped_main() -> anyhow::Result { let mut node_to_extract = &mut root_tree_node.node; if let Some(subset) = subset { - for path_to_descend in subset.split('/').filter(|s| ! s.is_empty()) { + for path_to_descend in subset.split('/').filter(|s| !s.is_empty()) { match node_to_extract.child(path_to_descend) { Ok(new_node) => { node_to_extract = new_node; diff --git a/yama/src/definitions.rs b/yama/src/definitions.rs index 29ea33e..8c2e0e4 100644 --- a/yama/src/definitions.rs +++ b/yama/src/definitions.rs @@ -274,25 +274,13 @@ impl TreeNode { /// Recurses into a child by name, or returns Err with a reason. pub fn child(&mut self, name: &str) -> Result<&mut TreeNode, &'static str> { match self { - TreeNode::NormalFile { .. } => { - Err("not a directory: normal file") - } - TreeNode::Directory { children, .. } => { - match children.get_mut(name) { - None => { - Err("child not in directory") - } - Some(node) => { - Ok(node) - } - } - } - TreeNode::SymbolicLink { .. } => { - Err("not a directory: symlink") - } - TreeNode::Deleted => { - Err("not a directory: deleted") - } + TreeNode::NormalFile { .. } => Err("not a directory: normal file"), + TreeNode::Directory { children, .. } => match children.get_mut(name) { + None => Err("child not in directory"), + Some(node) => Ok(node), + }, + TreeNode::SymbolicLink { .. } => Err("not a directory: symlink"), + TreeNode::Deleted => Err("not a directory: deleted"), } } }