insert doesn't need to have children count check
This commit is contained in:
parent
757e854d45
commit
4a111f9b58
1 changed files with 0 additions and 10 deletions
|
|
@ -146,17 +146,7 @@ impl<'a> NodeModifier<'a> {
|
|||
mut node: Node,
|
||||
between: Option<usize>,
|
||||
) -> Result<(), NodeManipulationError> {
|
||||
if let Some(x) = self.picked_node.max_children_count {
|
||||
if self.picked_node.children.len() + 1 > x {
|
||||
return Err(NodeManipulationError::TooMuchChildren(node));
|
||||
}
|
||||
}
|
||||
let children_count = self.picked_node.children.len();
|
||||
if let NodeHandler::Empty = &self.picked_node.handler
|
||||
&& children_count - 1 > 0
|
||||
{
|
||||
return Err(NodeManipulationError::TooMuchChildren(node));
|
||||
}
|
||||
if children_count <= 0 {
|
||||
return Err(NodeManipulationError::NotEnoughChildren);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue