From: Ben Pfaff Date: Fri, 2 Jan 2026 03:24:12 +0000 (-0800) Subject: cleanup X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e0e7688f4e40514f3ebd4ab30f75fd9638495b2;p=pspp cleanup --- diff --git a/rust/pspp/src/spv/read/legacy_xml.rs b/rust/pspp/src/spv/read/legacy_xml.rs index 6f4acfc0ff..862920b3a1 100644 --- a/rust/pspp/src/spv/read/legacy_xml.rs +++ b/rust/pspp/src/spv/read/legacy_xml.rs @@ -770,9 +770,9 @@ impl Visualization { } } - #[derive(Default, Debug)] + #[derive(Debug)] struct Target<'a> { - format: Option<(&'a SetFormat, Option)>, + format: (&'a SetFormat, Option), } 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)]