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

index e4c575a090f3e226db71a77b3dc511e9c7bb3639..ea27c1e00c2558e20cdc8d17dc7c94c50d7d18a1 100644 (file)
@@ -60,16 +60,8 @@ impl DataValue {
     /// Category index, if any.  This is the numeric value of the datum, if
     /// there is one, falling back to the index.
     pub fn category(&self) -> Option<usize> {
-        match &self.value {
-            Datum::Number(number) => *number,
-            _ if self.index.is_some() => self.index,
-            Datum::String(string) => {
-                // This only comes up in a few cases which indicate something
-                // odd might have happened to the table in the SPV files.
-                string.parse().ok()
-            }
-        }
-        .and_then(|v| (v >= 0.0 && v < usize::MAX as f64).then_some(v as usize))
+        self.index
+            .and_then(|v| (v >= 0.0 && v < usize::MAX as f64).then_some(v as usize))
     }
 
     /// Interprets this data value as a [Format], first by looking it up in