From: Ben Pfaff Date: Fri, 2 Jan 2026 03:29:53 +0000 (-0800) Subject: cleanup X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7d01073e6bcc80aa85e6b01ce86cfde889de7f2;p=pspp cleanup --- diff --git a/rust/pspp/src/spv/read/legacy_xml.rs b/rust/pspp/src/spv/read/legacy_xml.rs index 862920b3a1..99fd8f6be2 100644 --- a/rust/pspp/src/spv/read/legacy_xml.rs +++ b/rust/pspp/src/spv/read/legacy_xml.rs @@ -738,9 +738,7 @@ impl Visualization { #[derive(Copy, Clone, Debug, PartialEq)] enum TargetType { - Graph, Labeling, - Interval, MajorTicks, } @@ -750,18 +748,10 @@ impl Visualization { graph: &Graph, major_ticks: &HashMap<&str, &MajorTicks>, ) -> Option { - if let Some(id) = &graph.id - && id == target - { - Some(Self::Graph) - } else if let Some(id) = &graph.interval.labeling.id + if let Some(id) = &graph.interval.labeling.id && id == target { Some(Self::Labeling) - } else if let Some(id) = &graph.interval.id - && id == target - { - Some(Self::Interval) } else if major_ticks.contains_key(target) { Some(Self::MajorTicks) } else { @@ -772,7 +762,8 @@ impl Visualization { #[derive(Debug)] struct Target<'a> { - format: (&'a SetFormat, Option), + sf: &'a SetFormat, + target_type: TargetType, } impl<'a> Target<'a> { fn decode( @@ -796,11 +787,8 @@ impl Visualization { } } - match self { - Self { - format: (_, Some(TargetType::MajorTicks)), - .. - } if !wheres.is_empty() => { + match self.target_type { + TargetType::MajorTicks => { // Formatting for individual row or column labels. for w in &wheres { let Some(s) = series.get(w.variable.as_str()) else { @@ -822,7 +810,7 @@ impl Visualization { { Style::apply_to_value( category.name_mut(), - Some(&self.format.0), + Some(&self.sf), None, None, &look.areas[Area::Labels(axis)], @@ -833,10 +821,7 @@ impl Visualization { } } } - Self { - format: (_, Some(TargetType::Labeling)), - .. - } => { + TargetType::Labeling => { // Formatting for individual cells or groups of them // with some dimensions in common. let mut include = vec![HashSet::new(); dims.len()]; @@ -881,7 +866,7 @@ impl Visualization { if !skip { Style::apply_to_value( value, - Some(&self.format.0), + Some(&self.sf), None, None, &look.areas[Area::Data(RowParity::Even)], @@ -891,7 +876,6 @@ impl Visualization { } } } - _ => (), } } } @@ -900,10 +884,11 @@ impl Visualization { for set in &scp.sets { match set { Set::SetFormat(sf) => { - let target_type = TargetType::from_id(&sf.target, graph, &major_ticks); - targets.push(Target { - format: (sf, target_type), - }); + if let Some(target_type) = + TargetType::from_id(&sf.target, graph, &major_ticks) + { + targets.push(Target { sf, target_type }); + } } Set::Other => (), } @@ -933,11 +918,11 @@ impl Visualization { } (None, true) => { for target in &targets { - if target.format.1 == Some(TargetType::Labeling) { + if target.target_type == TargetType::Labeling { for value in data.values_mut() { Style::apply_to_value( value, - Some(target.format.0), + Some(&target.sf), None, None, &look.areas[Area::Data(RowParity::Even)],