rustfmt
This commit is contained in:
parent
58c5c3f039
commit
cf502b7f7e
@ -274,25 +274,13 @@ impl TreeNode {
|
|||||||
/// Recurses into a child by name, or returns Err with a reason.
|
/// Recurses into a child by name, or returns Err with a reason.
|
||||||
pub fn child(&mut self, name: &str) -> Result<&mut TreeNode, &'static str> {
|
pub fn child(&mut self, name: &str) -> Result<&mut TreeNode, &'static str> {
|
||||||
match self {
|
match self {
|
||||||
TreeNode::NormalFile { .. } => {
|
TreeNode::NormalFile { .. } => Err("not a directory: normal file"),
|
||||||
Err("not a directory: normal file")
|
TreeNode::Directory { children, .. } => match children.get_mut(name) {
|
||||||
}
|
None => Err("child not in directory"),
|
||||||
TreeNode::Directory { children, .. } => {
|
Some(node) => Ok(node),
|
||||||
match children.get_mut(name) {
|
},
|
||||||
None => {
|
TreeNode::SymbolicLink { .. } => Err("not a directory: symlink"),
|
||||||
Err("child not in directory")
|
TreeNode::Deleted => Err("not a directory: deleted"),
|
||||||
}
|
|
||||||
Some(node) => {
|
|
||||||
Ok(node)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TreeNode::SymbolicLink { .. } => {
|
|
||||||
Err("not a directory: symlink")
|
|
||||||
}
|
|
||||||
TreeNode::Deleted => {
|
|
||||||
Err("not a directory: deleted")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user