Skip to content

Commit b37361a

Browse files
committed
refactor: excel revert mistaken alloc optimization for trim path
1 parent 17780b5 commit b37361a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/cmd/excel.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,12 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
10041004
.map(|chunk| {
10051005
// amortize allocations
10061006
let mut record = csv::StringRecord::with_capacity(512, col_count);
1007+
let mut trimmed_record = if trim {
1008+
csv::StringRecord::with_capacity(512, col_count)
1009+
} else {
1010+
csv::StringRecord::new()
1011+
};
1012+
10071013
let mut work_date;
10081014
let mut error_buffer = String::new();
10091015
let mut formatted_date = String::new();
@@ -1111,7 +1117,6 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
11111117
}
11121118

11131119
if trim {
1114-
let mut trimmed_record = csv::StringRecord::with_capacity(512, col_count);
11151120
// record.trim() is faster than trimming each field piecemeal
11161121
record.trim();
11171122
record.iter().for_each(|field| {

0 commit comments

Comments
 (0)