From: Ben Pfaff Date: Wed, 19 Aug 2026 00:51:39 +0000 (-0700) Subject: avoid an allocation X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec1488c15e1b46888e5e0ff11b7e2c54447c5546;p=pspp avoid an allocation --- diff --git a/rust/pspp/src/spv/read/graph.rs b/rust/pspp/src/spv/read/graph.rs index d3fc583df7..4869e1a599 100644 --- a/rust/pspp/src/spv/read/graph.rs +++ b/rust/pspp/src/spv/read/graph.rs @@ -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, } }