cleanup
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 2 Jan 2026 03:29:53 +0000 (19:29 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 2 Jan 2026 03:29:53 +0000 (19:29 -0800)
rust/pspp/src/spv/read/legacy_xml.rs

index 862920b3a1e5b38c7750a0125fe1e7c9233d2980..99fd8f6be2aa07132e333e7873ac2d4bce2591a7 100644 (file)
@@ -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<Self> {
-                    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<TargetType>),
+                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)],