From: Ben Pfaff Date: Fri, 2 Jan 2026 19:58:59 +0000 (-0800) Subject: cleanup X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c723bf3eb5dbae8d96a17a685cecee1eeed6e4f9;p=pspp cleanup --- diff --git a/rust/pspp/src/spv/read/legacy_xml.rs b/rust/pspp/src/spv/read/legacy_xml.rs index 5a56934d88..51e4480e67 100644 --- a/rust/pspp/src/spv/read/legacy_xml.rs +++ b/rust/pspp/src/spv/read/legacy_xml.rs @@ -316,7 +316,6 @@ impl Visualization { ) -> Result { let mut graph = None; let mut labels = EnumMap::from_fn(|_| Vec::new()); - let mut styles = HashMap::new(); for child in &self.children { match child { VisChild::Graph(g) => graph = Some(g), @@ -336,24 +335,14 @@ impl Visualization { } } } - VisChild::Style(style) => { - if let Some(id) = &style.id { - styles.insert(id.as_str(), style); - } - } - VisChild::SourceVariable(_) | VisChild::DerivedVariable(_) | VisChild::Other => (), + VisChild::Style(_) + | VisChild::SourceVariable(_) + | VisChild::DerivedVariable(_) + | VisChild::Other => (), } } let Some(graph) = graph else { todo!() }; - let axes = graph - .facet_layout - .children - .iter() - .filter_map(|child| child.facet_level()) - .map(|facet_level| (facet_level.level, &facet_level.axis)) - .collect::>(); - let footnotes = self.decode_footnotes(graph, &labels[Purpose::Footnote]); let title = LabelFrame::decode_label(&labels[Purpose::Title], &footnotes); @@ -562,6 +551,19 @@ impl Visualization { coordinate: &'a Series, } + let axes = graph + .facet_layout + .children + .iter() + .filter_map(|child| child.facet_level()) + .map(|facet_level| (facet_level.level, &facet_level.axis)) + .collect::>(); + let styles = self + .children + .iter() + .filter_map(|child| child.style()) + .filter_map(|style| style.id.as_ref().map(|id| (id.as_str(), style))) + .collect::>(); let mut dims = Vec::new(); let mut level_ofs = 1; let dim_series = graph.faceting.dimensions().map(|axis, dimension| { @@ -924,6 +926,15 @@ enum VisChild { Other, } +impl VisChild { + fn style(&self) -> Option<&Style> { + match self { + Self::Style(style) => Some(style), + _ => None, + } + } +} + #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] struct SourceVariable {