From 73dfb4be88e68e1e326ad04a21a73539755e59d0 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 20 Jan 2025 12:59:46 +0100 Subject: [PATCH] Add comment to explain why we do what we do --- crates/build/re_types_builder/src/codegen/rust/serializer.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/build/re_types_builder/src/codegen/rust/serializer.rs b/crates/build/re_types_builder/src/codegen/rust/serializer.rs index 9aeacdf84927..11d3facc4b8c 100644 --- a/crates/build/re_types_builder/src/codegen/rust/serializer.rs +++ b/crates/build/re_types_builder/src/codegen/rust/serializer.rs @@ -627,6 +627,7 @@ fn quote_arrow_field_serializer( ); // Offsets is always non-empty. The last element is the total length of buffer we need. + // We want this capacity in order to allocate exactly as much memory as we need. #[allow(clippy::unwrap_used)] let capacity = offsets.last().copied().unwrap() as usize; @@ -645,6 +646,7 @@ fn quote_arrow_field_serializer( ); // Offsets is always non-empty. The last element is the total length of buffer we need. + // We want this capacity in order to allocate exactly as much memory as we need. #[allow(clippy::unwrap_used)] let capacity = offsets.last().copied().unwrap() as usize;