]> pintos-os.org Git - pspp/commitdiff
cleanup
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 27 Apr 2026 17:53:20 +0000 (10:53 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 27 Apr 2026 17:53:20 +0000 (10:53 -0700)
rust/pspp/src/spv/read/graph.rs

index bdd1f5778cb48c76e40aa5c21d5f65d66f381686..0e23359412da72ecb242c167c2d08882641717b9 100644 (file)
@@ -187,7 +187,7 @@ impl Locations for Visualization {
 }
 
 impl Visualization {
-    pub fn decode_series(
+    fn decode_series(
         &self,
         locale: &'static Locale<'static>,
         data: DataSources,
@@ -473,7 +473,7 @@ impl Visualization {
         Ok(elements)
     }
 
-    pub fn delimited_file_source(&self) -> Option<&DelimitedFileSource> {
+    fn delimited_file_source(&self) -> Option<&DelimitedFileSource> {
         self.children
             .iter()
             .find_map(|child| child.delimited_file_source())
@@ -1024,7 +1024,7 @@ impl FontMetrics {
 }
 
 #[derive(Clone, Debug)]
-pub struct SeriesValue {
+struct SeriesValue {
     value: Datum<String>,
     label: Option<String>,
 }
@@ -1042,15 +1042,15 @@ where
 }
 
 #[derive(Clone)]
-pub struct Series {
+struct Series {
     pub name: String,
     label: Option<String>,
     short_label: Option<String>,
     weight: bool,
     key: bool,
     categorical: bool,
-    pub values: Vec<SeriesValue>,
-    pub unique_values: Vec<SeriesValue>,
+    values: Vec<SeriesValue>,
+    unique_values: Vec<SeriesValue>,
     formatter: Formatter,
 }
 
@@ -1167,7 +1167,7 @@ impl VisChild {
 
 #[derive(Deserialize, Debug)]
 #[serde(rename_all = "camelCase")]
-pub struct DelimitedFileSource {
+struct DelimitedFileSource {
     /// Source name.
     #[serde(rename = "@id")]
     pub id: String,
@@ -1270,7 +1270,7 @@ impl EmbeddedSource {
 
 #[derive(Deserialize, Debug, Default)]
 #[serde(rename_all = "camelCase")]
-pub enum DelimitedFileSourceMissing {
+enum DelimitedFileSourceMissing {
     #[default]
     Pairwise,
 }
@@ -2292,7 +2292,7 @@ enum Mdy {
     Year,
 }
 
-pub struct NotMdy;
+struct NotMdy;
 
 impl TryFrom<&Item<'_>> for Mdy {
     type Error = NotMdy;
@@ -4463,7 +4463,7 @@ impl Span {
 }
 
 #[derive(Copy, Clone, Debug, PartialEq)]
-pub struct Scaling {
+struct Scaling {
     /// Smallest tick.
     pub base: f64,
 
@@ -4706,7 +4706,7 @@ impl<'a> Iterator for FacetIterator<'a> {
 
 impl<'a> ExactSizeIterator for FacetIterator<'a> {}
 
-pub struct SemicolonSplit<'a>(Option<&'a str>);
+struct SemicolonSplit<'a>(Option<&'a str>);
 
 impl<'a> SemicolonSplit<'a> {
     fn new(s: &'a str) -> Self {
@@ -4846,6 +4846,8 @@ impl crate::output::Graph {
             return Cow::Borrowed(self);
         }
 
+        // Copy the input to the output, except for parsing data out of all the
+        // `embeddedSource` elements and replacing them with `userSource` stubs.
         let mut data = IndexMap::new();
         let mut reader = Reader::from_reader(self.xml.as_slice());
         let mut writer = Writer::new(Vec::new());
@@ -4899,14 +4901,17 @@ impl crate::output::Graph {
             }
         }
 
-        if data.is_empty() {
-            Cow::Borrowed(self)
-        } else {
+        if !data.is_empty() {
+            // Turn the parsed data into a `.bin` member.
             Cow::Owned(crate::output::Graph {
                 xml: writer.into_inner(),
                 data: Some(DataSources(data).to_legacy_bin()),
                 csv: self.csv.clone(),
             })
+        } else {
+            // We didn't find any `embeddedSource` elements, so stick with what
+            // we had.
+            Cow::Borrowed(self)
         }
     }