simplify BalancingError
This commit is contained in:
parent
4f702288dd
commit
9d5b4c5fd4
@ -48,14 +48,11 @@ pub enum BalancingError {
|
|||||||
impl Display for BalancingError {
|
impl Display for BalancingError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Height(height_error) => write!(f, "invalid AVL non-leaf height: {height_error}"),
|
Self::Height(height_error) => write!(f, "height error: {height_error}"),
|
||||||
Self::Balance(hl, hr) => write!(f, "unbalanced AVL node: {hl} {hr}."),
|
Self::Balance(hl, hr) => write!(f, "unbalanced node: {hl} {hr}."),
|
||||||
Self::HeightOverflow => write!(f, "AVL tree height overflow"),
|
Self::HeightOverflow => write!(f, "tree height overflow"),
|
||||||
Self::HeightMismatch { children, parent } => {
|
Self::HeightMismatch { children, parent } => {
|
||||||
write!(
|
write!(f, "child-parent height mismatch: {children:?}, {parent}")
|
||||||
f,
|
|
||||||
"AVL child-parent height mismatch: {children:?}, {parent}"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user