From: Ben Pfaff Date: Sat, 27 Dec 2025 01:04:20 +0000 (-0800) Subject: simplify Target X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f694a800f78da916bc348cc495a42b4fee649795;p=pspp simplify Target --- diff --git a/rust/pspp/src/spv/read/legacy_xml.rs b/rust/pspp/src/spv/read/legacy_xml.rs index 5171060bdd..7a4ecd33d3 100644 --- a/rust/pspp/src/spv/read/legacy_xml.rs +++ b/rust/pspp/src/spv/read/legacy_xml.rs @@ -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)>, @@ -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(