From 58ee11c63a07b8b883500326084b26edf679a35b Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Fri, 6 Oct 2023 05:59:06 -0400 Subject: [PATCH] `cat`: use empty_byte_record to skip one more allocation --- src/cmd/cat.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/cat.rs b/src/cmd/cat.rs index eab637ac3..650324553 100644 --- a/src/cmd/cat.rs +++ b/src/cmd/cat.rs @@ -149,7 +149,8 @@ impl Args { for c in &columns_global { wtr.write_field(c)?; } - wtr.write_byte_record(&csv::ByteRecord::new())?; + let empty_byte_record = csv::ByteRecord::new(); + wtr.write_byte_record(&empty_byte_record)?; // amortize allocations #[allow(unused_assignments)] @@ -159,7 +160,6 @@ impl Args { let mut h: &csv::ByteRecord; let mut columns_of_this_file = IndexMap::with_capacity(num_columns_global); let mut row: csv::ByteRecord; - let empty_byte_record = csv::ByteRecord::new(); for conf in self.configs()? { if conf.is_stdin() {