Skip to content

Commit

Permalink
modify reject algorithm for identical elements
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Mar 14, 2023
1 parent c7583ec commit 3c11558
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/nu-protocol/src/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,13 +1231,17 @@ impl Value {
span: v_span,
} => {
let mut found = false;
for (i, col) in cols.clone().iter().enumerate() {
let mut index = 0;
cols.retain_mut(|col| {
if col == col_name {
cols.remove(i);
vals.remove(i);
found = true;
vals.remove(index);
false
} else {
index += 1;
true
}
}
});
if !found {
return Err(ShellError::CantFindColumn {
col_name: col_name.to_string(),
Expand Down

0 comments on commit 3c11558

Please sign in to comment.