insert doesn't need to have children count check

This commit is contained in:
Rendo 2025-11-10 08:37:56 +05:00
commit 4a111f9b58

View file

@ -146,17 +146,7 @@ impl<'a> NodeModifier<'a> {
mut node: Node, mut node: Node,
between: Option<usize>, between: Option<usize>,
) -> Result<(), NodeManipulationError> { ) -> 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(); 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 { if children_count <= 0 {
return Err(NodeManipulationError::NotEnoughChildren); return Err(NodeManipulationError::NotEnoughChildren);
} }