mirror of
https://github.com/nushell/nushell
synced 2024-12-26 21:13:19 +00:00
use reverse iter on value search (#5553)
This commit is contained in:
parent
8bd68416e3
commit
fc41a0f96b
2 changed files with 6 additions and 4 deletions
|
@ -2,8 +2,6 @@ use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
|||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn row() {
|
||||
Playground::setup("merge_test_1", |dirs, sandbox| {
|
||||
|
|
|
@ -660,8 +660,12 @@ impl Value {
|
|||
let cols = cols.clone();
|
||||
let span = *span;
|
||||
|
||||
if let Some(found) =
|
||||
cols.iter().zip(vals.iter()).find(|x| x.0 == column_name)
|
||||
// Make reverse iterate to avoid duplicate column leads to first value, actuall last value is expected.
|
||||
if let Some(found) = cols
|
||||
.iter()
|
||||
.zip(vals.iter())
|
||||
.rev()
|
||||
.find(|x| x.0 == column_name)
|
||||
{
|
||||
current = found.1.clone();
|
||||
} else if let Some(suggestion) = did_you_mean(&cols, column_name) {
|
||||
|
|
Loading…
Reference in a new issue