From 34689743a5f7a2605d052bb856e626832a30efc2 Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:49:20 +0100 Subject: [PATCH] poly: small refactor in SparseTerm partial_cmp (#872) --- poly/src/polynomial/multivariate/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/poly/src/polynomial/multivariate/mod.rs b/poly/src/polynomial/multivariate/mod.rs index 7604082ff..7afe73b1e 100644 --- a/poly/src/polynomial/multivariate/mod.rs +++ b/poly/src/polynomial/multivariate/mod.rs @@ -146,13 +146,15 @@ impl PartialOrd for SparseTerm { } else { // Iterate through all variables and return the corresponding ordering // if they differ in variable numbering or power - for (cur, other) in self.iter().zip(other.iter()) { - if other.0 == cur.0 { - if cur.1 != other.1 { - return Some((cur.1).cmp(&other.1)); + for ((cur_variable, cur_power), (other_variable, other_power)) in + self.iter().zip(other.iter()) + { + if other_variable == cur_variable { + if cur_power != other_power { + return Some(cur_power.cmp(other_power)); } } else { - return Some((other.0).cmp(&cur.0)); + return Some(other_variable.cmp(cur_variable)); } } Some(Ordering::Equal)