mirror of
https://github.com/nushell/nushell
synced 2025-01-13 21:55:07 +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::playground::Playground;
|
||||||
use nu_test_support::{nu, pipeline};
|
use nu_test_support::{nu, pipeline};
|
||||||
|
|
||||||
// FIXME: jt: needs more work
|
|
||||||
#[ignore]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn row() {
|
fn row() {
|
||||||
Playground::setup("merge_test_1", |dirs, sandbox| {
|
Playground::setup("merge_test_1", |dirs, sandbox| {
|
||||||
|
|
|
@ -660,8 +660,12 @@ impl Value {
|
||||||
let cols = cols.clone();
|
let cols = cols.clone();
|
||||||
let span = *span;
|
let span = *span;
|
||||||
|
|
||||||
if let Some(found) =
|
// Make reverse iterate to avoid duplicate column leads to first value, actuall last value is expected.
|
||||||
cols.iter().zip(vals.iter()).find(|x| x.0 == column_name)
|
if let Some(found) = cols
|
||||||
|
.iter()
|
||||||
|
.zip(vals.iter())
|
||||||
|
.rev()
|
||||||
|
.find(|x| x.0 == column_name)
|
||||||
{
|
{
|
||||||
current = found.1.clone();
|
current = found.1.clone();
|
||||||
} else if let Some(suggestion) = did_you_mean(&cols, column_name) {
|
} else if let Some(suggestion) = did_you_mean(&cols, column_name) {
|
||||||
|
|
Loading…
Reference in a new issue