From 4d81d367fef1883448dfd1276cfd1448845069f8 Mon Sep 17 00:00:00 2001 From: sholderbach Date: Fri, 2 Aug 2024 23:38:43 +0200 Subject: [PATCH] Only run `SharedCow::to_mut` once Peeping at the `cargo asm` output that this can't be elided due to side effects of the atomic reads, so lifting it manually should save us some extra work. --- crates/nu-command/src/filters/default.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/nu-command/src/filters/default.rs b/crates/nu-command/src/filters/default.rs index 60c43fa88f..e269c58ccd 100644 --- a/crates/nu-command/src/filters/default.rs +++ b/crates/nu-command/src/filters/default.rs @@ -102,12 +102,13 @@ fn default( val: ref mut record, .. } => { - if let Some(val) = record.to_mut().get_mut(&column.item) { + let record = record.to_mut(); + if let Some(val) = record.get_mut(&column.item) { if matches!(val, Value::Nothing { .. }) { *val = value.clone(); } } else { - record.to_mut().push(column.item.clone(), value.clone()); + record.push(column.item.clone(), value.clone()); } item