office: remove dead xml helper, clippy hygiene in formula
- Commit
18c8fbbcd6c7656f0965dcd55dd7878dbb84e964- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 21:56 UTC (4 days ago)
- Parents
ff7c19d
Workspace clippy flagged local_name_of_resolved in xml.rs as never used (dead-code sweep): removed it and the LocalName import it orphaned. In formula: a manual !Range::contains on the row bound (now !(0..1048576).contains), a redundant closure wrapping cmp_values (now sort_by(cmp_values)), and an explicit .into_iter() on an IntoIterator argument (now zip(vals)). Left standing deliberately: the deprecated quick-xml unescape_value call (normalized_value has different entity and whitespace semantics, so swapping it is a behaviour decision, not hygiene) and is_multiple_of, stable since Rust 1.87, above the 1.85 MSRV in clippy.toml. Verified: cargo clippy -p office_engine --all-targets shows only those two items, cargo test -p office_engine (105 passed), fmt clean.
Diff
office/src/main/rust/src/formula_part11.rs
diff --git a/office/src/main/rust/src/formula_part11.rs b/office/src/main/rust/src/formula_part11.rsindex 72314404c7..ec8f9b1e38 100644--- a/office/src/main/rust/src/formula_part11.rs+++ b/office/src/main/rust/src/formula_part11.rs@@ -122,7 +122,7 @@ fn parse_a1_coords(token: &str) -> Option<(i32, i32)> { return None; } let row = digits.parse::<i32>().ok()? - 1;- if row < 0 || row >= 1048576 {+ if !(0..1048576).contains(&row) { return None; } Some((row, col_to_index(&letters)))
office/src/main/rust/src/formula_part12.rs
diff --git a/office/src/main/rust/src/formula_part12.rs b/office/src/main/rust/src/formula_part12.rsindex 6ca32d742b..5ad7bc5530 100644--- a/office/src/main/rust/src/formula_part12.rs+++ b/office/src/main/rust/src/formula_part12.rs@@ -39,7 +39,7 @@ impl<'a> Evaluator<'a> { return Err(ferr("#VALUE!")); } let desc = order == -1;- vals.sort_by(|x, y| cmp_values(x, y));+ vals.sort_by(cmp_values); if desc { vals.reverse(); }@@ -57,7 +57,7 @@ impl<'a> Evaluator<'a> { return Err(ferr("#VALUE!")); } let mut paired: Vec<(Value, Value)> =- keys.into_iter().zip(vals.into_iter()).collect();+ keys.into_iter().zip(vals).collect(); paired.sort_by(|x, y| cmp_values(&x.0, &y.0)); if order == -1 { paired.reverse();
office/src/main/rust/src/xml.rs
diff --git a/office/src/main/rust/src/xml.rs b/office/src/main/rust/src/xml.rsindex 3b2c298a6b..1199803935 100644--- a/office/src/main/rust/src/xml.rs+++ b/office/src/main/rust/src/xml.rs@@ -20,7 +20,7 @@ use quick_xml::events::attributes::Attribute; use quick_xml::events::Event as QEvent;-use quick_xml::name::{LocalName, QName, ResolveResult};+use quick_xml::name::{QName, ResolveResult}; use quick_xml::NsReader; #[derive(Debug, Clone, Copy, PartialEq, Eq)]@@ -270,12 +270,6 @@ fn local_name_of(qname: QName) -> String { } } -/// Local name from a resolved [`LocalName`].-fn local_name_of_resolved(local: LocalName) -> String {- let name: &str = local.as_ref();- name.to_owned()-}- /// OOXML toggle attribute: absent means on; otherwise `1`/`true`/`on`. pub fn bool_attr(value: Option<&str>) -> bool { match value {