]> pintos-os.org Git - pspp/commitdiff
avoid an allocation
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 19 Aug 2026 00:51:39 +0000 (17:51 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 19 Aug 2026 00:51:39 +0000 (17:51 -0700)
rust/pspp/src/spv/read/graph.rs

index d3fc583df7ea14643a277144969b39aa81665935..4869e1a599f18c0a856982177d9e49982642206b 100644 (file)
@@ -4444,13 +4444,13 @@ impl<'a> FrameType<'a> {
         }
     }
 
-    fn locations(&self) -> Vec<&Location> {
+    fn locations(&self) -> &[Location] {
         match self {
-            FrameType::Visualization(visualization) => visualization.locations(),
-            FrameType::Container(container) => container.locations.iter().collect(),
-            FrameType::Graph(graph) => graph.locations.iter().collect(),
-            FrameType::LabelFrame(label_frame) => label_frame.locations(),
-            FrameType::Legend(legend) => legend.locations(),
+            FrameType::Visualization(visualization) => &visualization.locations,
+            FrameType::Container(container) => &container.locations,
+            FrameType::Graph(graph) => &graph.locations,
+            FrameType::LabelFrame(label_frame) => &label_frame.locations,
+            FrameType::Legend(legend) => &legend.locations,
         }
     }