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

index 6f4acfc0ffb4377cfe04cde0223ac7ef7a2bdf6a..862920b3a1e5b38c7750a0125fe1e7c9233d2980 100644 (file)
@@ -770,9 +770,9 @@ impl Visualization {
                 }
             }
 
-            #[derive(Default, Debug)]
+            #[derive(Debug)]
             struct Target<'a> {
-                format: Option<(&'a SetFormat, Option<TargetType>)>,
+                format: (&'a SetFormat, Option<TargetType>),
             }
             impl<'a> Target<'a> {
                 fn decode(
@@ -798,7 +798,7 @@ impl Visualization {
 
                     match self {
                         Self {
-                            format: Some((_, Some(TargetType::MajorTicks))),
+                            format: (_, Some(TargetType::MajorTicks)),
                             ..
                         } if !wheres.is_empty() => {
                             // Formatting for individual row or column labels.
@@ -822,7 +822,7 @@ impl Visualization {
                                     {
                                         Style::apply_to_value(
                                             category.name_mut(),
-                                            self.format.map(|(sf, _)| sf),
+                                            Some(&self.format.0),
                                             None,
                                             None,
                                             &look.areas[Area::Labels(axis)],
@@ -834,7 +834,7 @@ impl Visualization {
                             }
                         }
                         Self {
-                            format: Some((_, Some(TargetType::Labeling))),
+                            format: (_, Some(TargetType::Labeling)),
                             ..
                         } => {
                             // Formatting for individual cells or groups of them
@@ -881,7 +881,7 @@ impl Visualization {
                                 if !skip {
                                     Style::apply_to_value(
                                         value,
-                                        self.format.map(|(sf, _)| sf),
+                                        Some(&self.format.0),
                                         None,
                                         None,
                                         &look.areas[Area::Data(RowParity::Even)],
@@ -895,18 +895,17 @@ impl Visualization {
                     }
                 }
             }
+            //let mut targets = scp.sets.iter().filter_map(|set| set.as_set_format());
             let mut targets = Vec::new();
             for set in &scp.sets {
                 match set {
-                    Set::SetStyle(_) => (),
                     Set::SetFormat(sf) => {
                         let target_type = TargetType::from_id(&sf.target, graph, &major_ticks);
                         targets.push(Target {
-                            format: Some((sf, target_type)),
+                            format: (sf, target_type),
                         });
                     }
-                    Set::SetFrameStyle(_) => (),
-                    Set::SetMetaData(_) => (),
+                    Set::Other => (),
                 }
             }
 
@@ -934,13 +933,11 @@ impl Visualization {
                 }
                 (None, true) => {
                     for target in &targets {
-                        if target.format.is_some_and(|(_sf, target_type)| {
-                            target_type == Some(TargetType::Labeling)
-                        }) {
+                        if target.format.1 == Some(TargetType::Labeling) {
                             for value in data.values_mut() {
                                 Style::apply_to_value(
                                     value,
-                                    target.format.map(|(sf, _target_type)| sf),
+                                    Some(target.format.0),
                                     None,
                                     None,
                                     &look.areas[Area::Data(RowParity::Even)],
@@ -2329,10 +2326,18 @@ struct IntersectWhere {
 #[derive(Deserialize, Debug)]
 #[serde(rename_all = "camelCase")]
 enum Set {
-    SetStyle(SetStyle),
-    SetFrameStyle(SetFrameStyle),
     SetFormat(SetFormat),
-    SetMetaData(SetMetaData),
+    #[serde(other)]
+    Other,
+}
+
+impl Set {
+    fn as_set_format(&self) -> Option<&SetFormat> {
+        match self {
+            Set::SetFormat(set_format) => Some(set_format),
+            Set::Other => None,
+        }
+    }
 }
 
 #[derive(Deserialize, Debug)]