From 9bd0318702e2b421b0cbf652798393f13cff9222 Mon Sep 17 00:00:00 2001 From: electria Date: Tue, 20 Oct 2026 18:00:08 -0700 Subject: [PATCH] refactor: make Operator/Function ordering consistent --- src/nodes/eval.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/nodes/eval.rs b/src/nodes/eval.rs index cbc139b..25fe190 100644 --- a/src/nodes/eval.rs +++ b/src/nodes/eval.rs @@ -127,6 +127,17 @@ fn collapse_toplevel(nodes: &mut Vec, mut end: usize) -> Result<(), Error> Ok(()) } +impl Operator { + fn apply_to(&self, rhs: &mut Float, lhs: Float) { + match self { + Self::Plus => Float::add_from(rhs, lhs), + Self::Minus => Float::sub_from(rhs, lhs), + Self::Mult => Float::mul_from(rhs, lhs), + Self::Div => Float::div_from(rhs, lhs), + Self::Exp => Float::pow_from(rhs, lhs), + } + } +} impl Function { fn apply_to(&self, n: &mut Float) { match self { @@ -145,17 +156,6 @@ impl Function { } } } -impl Operator { - fn apply_to(&self, rhs: &mut Float, lhs: Float) { - match self { - Self::Plus => Float::add_from(rhs, lhs), - Self::Minus => Float::sub_from(rhs, lhs), - Self::Mult => Float::mul_from(rhs, lhs), - Self::Div => Float::div_from(rhs, lhs), - Self::Exp => Float::pow_from(rhs, lhs), - } - } -} #[cfg(test)] mod tests {