cleanup
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 3 Jan 2026 19:43:47 +0000 (11:43 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 3 Jan 2026 19:43:47 +0000 (11:43 -0800)
rust/pspp/src/cli/show_spv.rs
rust/pspp/src/spv/read/legacy_xml.rs

index 95a87bff65a4b5400e72d31019c8dfd5e2a0c26b..ce2bec2c3077f52e686ec173c5df190db70ff54d 100644 (file)
@@ -202,7 +202,6 @@ impl ShowSpv {
                     ));
                     let mut pivot_table =
                         PivotTable::new([(Axis3::Y, index), (Axis3::X, variables)]);
-                    let formats = HashMap::new();
                     for (variable_index, (variable_name, values)) in
                         data.values().flat_map(|map| map.iter()).enumerate()
                     {
@@ -213,7 +212,7 @@ impl ShowSpv {
                                         value: data_value.clone(),
                                         index: None,
                                     }
-                                    .as_format(&formats)
+                                    .as_format()
                                     .to_string()
                                 }),
                             );
index ea27c1e00c2558e20cdc8d17dc7c94c50d7d18a1..ded22a20266123b6fcbd7edc30a6aeb99acb84f2 100644 (file)
@@ -68,19 +68,13 @@ impl DataValue {
     /// `format_map` and otherwise by interpreting it as a [Format] directly.
     ///
     /// This should probably be a method on some hypothetical FormatMap.
-    pub fn as_format(
-        &self,
-        format_map: &HashMap<i64, crate::format::Format>,
-    ) -> crate::format::Format {
+    pub fn as_format(&self) -> crate::format::Format {
         let f = match &self.value {
             Datum::Number(Some(number)) => *number as i64,
             Datum::Number(None) => 0,
             Datum::String(s) => s.parse().unwrap_or_default(),
         };
-        match format_map.get(&f) {
-            Some(format) => *format,
-            None => decode_format(f as u32, &mut |_| () /*XXX*/),
-        }
+        decode_format(f as u32, &mut |_| () /*XXX*/)
     }
 
     /// Returns this data value interpreted using `format`.
@@ -438,7 +432,7 @@ impl Visualization {
 
         let mut data = HashMap::new();
         let mut coords = Vec::with_capacity(dims.len());
-        let (cell_formats, format_map) = graph.interval.labeling.decode_format_map(&series);
+        let cell_formats = graph.interval.labeling.decode_format_map(&series);
         'outer: for (i, cell) in cell.values.iter().enumerate() {
             coords.clear();
             for dim in dims {
@@ -458,7 +452,7 @@ impl Visualization {
             let format = if let Some(cell_formats) = &cell_formats
                 && let Some(value) = cell_formats.values.get(i)
             {
-                value.as_format(&format_map)
+                value.as_format()
             } else {
                 F40_2
             };
@@ -1934,23 +1928,14 @@ struct Labeling {
 }
 
 impl Labeling {
-    fn decode_format_map<'a>(
-        &self,
-        series: &'a BTreeMap<&str, Series>,
-    ) -> (Option<&'a Series>, HashMap<i64, crate::format::Format>) {
-        let mut map = HashMap::new();
+    fn decode_format_map<'a>(&self, series: &'a BTreeMap<&str, Series>) -> Option<&'a Series> {
         let mut cell_format = None;
         for child in &self.children {
             if let LabelingChild::Formatting(formatting) = child {
                 cell_format = series.get(formatting.variable.as_str());
-                for mapping in &formatting.mappings {
-                    if let Some(format) = &mapping.format {
-                        map.insert(mapping.from, format.decode());
-                    }
-                }
             }
         }
-        (cell_format, map)
+        cell_format
     }
 }