simplify Target
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 27 Dec 2025 01:04:20 +0000 (17:04 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 27 Dec 2025 01:04:20 +0000 (17:04 -0800)
rust/pspp/src/spv/read/legacy_xml.rs

index 5171060bdda73dff5b233df5a8f6a397431f6809..7a4ecd33d3fe914e178a6f4f39f2e47ffc454655 100644 (file)
@@ -798,9 +798,7 @@ impl Visualization {
 
             #[derive(Default, Debug)]
             struct Target<'a> {
-                graph: Option<&'a Style>,
                 labeling: Option<&'a Style>,
-                interval: Option<&'a Style>,
                 major_ticks: Option<&'a Style>,
                 frame: Option<&'a Style>,
                 format: Option<(&'a SetFormat, Option<TargetType>)>,
@@ -818,40 +816,18 @@ impl Visualization {
                     has_cell_footnotes: bool,
                 ) {
                     let mut wheres = Vec::new();
-                    let mut alternating = false;
                     for child in &intersect.children {
                         match child {
                             IntersectChild::Where(w) => wheres.push(w),
                             IntersectChild::IntersectWhere(_) => {
                                 // Presumably we should do something (but we don't).
                             }
-                            IntersectChild::Alternating => alternating = true,
-                            IntersectChild::Empty => (),
+                            IntersectChild::Alternating | IntersectChild::Empty => (),
                         }
                     }
 
                     dbg!(&scp.id, self, intersect);
                     match self {
-                        Self {
-                            graph: Some(_),
-                            labeling: None,
-                            interval: None,
-                            major_ticks: None,
-                            frame: None,
-                            format: None,
-                        } => {
-                            // `graph.width` likely just sets the width of the table as a whole.
-                        }
-                        Self {
-                            graph: None,
-                            labeling: None,
-                            interval: None,
-                            major_ticks: None,
-                            frame: None,
-                            format: None,
-                        } => {
-                            // No-op.  (Presumably there's a setMetaData we don't care about.)
-                        }
                         Self {
                             format: Some((_, Some(TargetType::MajorTicks))),
                             ..
@@ -859,10 +835,7 @@ impl Visualization {
                         | Self {
                             major_ticks: Some(_),
                             ..
-                        }
-                        | Self { frame: Some(_), .. }
-                            if !wheres.is_empty() =>
-                        {
+                        } if !wheres.is_empty() => {
                             // Formatting for individual row or column labels.
                             dbg!();
                             for w in &wheres {
@@ -902,9 +875,6 @@ impl Visualization {
                         }
                         | Self {
                             labeling: Some(_), ..
-                        }
-                        | Self {
-                            interval: Some(_), ..
                         } => {
                             // Formatting for individual cells or groups of them
                             // with some dimensions in common.
@@ -972,11 +942,9 @@ impl Visualization {
                     Set::SetStyle(set_style) => {
                         if let Some(style) = set_style.style.get(&styles) {
                             match TargetType::from_id(&set_style.target, graph, &major_ticks) {
-                                Some(TargetType::Graph) => target.graph = Some(style),
-                                Some(TargetType::Interval) => target.interval = Some(style),
                                 Some(TargetType::Labeling) => target.labeling = Some(style),
                                 Some(TargetType::MajorTicks) => target.major_ticks = Some(style),
-                                None => (),
+                                Some(TargetType::Interval) | Some(TargetType::Graph) | None => (),
                             }
                         }
                     }
@@ -1020,7 +988,6 @@ impl Visualization {
                         .format
                         .is_some_and(|(_sf, target_type)| target_type == Some(TargetType::Labeling))
                         || target.labeling.is_some()
-                        || target.interval.is_some()
                     {
                         for value in data.values_mut() {
                             Style::apply_to_value(