Remove unnecessary $in usages

This commit is contained in:
132ikl 2025-02-26 23:04:04 -05:00
parent f5b8ae61cc
commit d02431bc1b
3 changed files with 6 additions and 6 deletions

View File

@ -23,7 +23,7 @@ fn catch_can_access_error() {
#[test] #[test]
fn catch_can_access_error_as_dollar_in() { fn catch_can_access_error_as_dollar_in() {
let output = nu!("try { foobarbaz } catch { $in | get raw }"); let output = nu!("try { foobarbaz } catch { get raw }");
assert!(output.err.contains("External command failed")); assert!(output.err.contains("External command failed"));
} }

View File

@ -4,7 +4,7 @@ def format-event [ ] {
# Replace numeric value of raw_code with hex string # Replace numeric value of raw_code with hex string
let record = match $record { let record = match $record {
{raw_code: $code} => { {raw_code: $code} => {
$record | update raw_code {|| $in | format number | get upperhex} $record | update raw_code {|| format number | get upperhex}
} }
_ => $record _ => $record
} }
@ -12,7 +12,7 @@ def format-event [ ] {
# Replace numeric value of raw_modifiers with binary string # Replace numeric value of raw_modifiers with binary string
let record = match $record { let record = match $record {
{raw_modifiers: $flags} => { {raw_modifiers: $flags} => {
$record | update raw_modifiers {|| $in | format number | get binary} $record | update raw_modifiers {|| format number | get binary}
} }
_ => $record _ => $record
} }

View File

@ -95,7 +95,7 @@ def xupdate-string-step [ step: string rest: list updater: closure ] {
} }
def xupdate-int-step [ step: int rest: list updater: closure ] { def xupdate-int-step [ step: int rest: list updater: closure ] {
$in | enumerate | each {|it| enumerate | each {|it|
let item = $it.item let item = $it.item
let idx = $it.index let idx = $it.index
@ -108,7 +108,7 @@ def xupdate-int-step [ step: int rest: list updater: closure ] {
} }
def xupdate-closure-step [ step: closure rest: list updater: closure ] { def xupdate-closure-step [ step: closure rest: list updater: closure ] {
$in | each {|it| each {|it|
if (do $step $it) { if (do $step $it) {
[ $it ] | xupdate-internal $rest $updater | get 0 [ $it ] | xupdate-internal $rest $updater | get 0
} else { } else {
@ -194,7 +194,7 @@ export def xinsert [
# position is greater than number of elements) in content of all entries of input matched by # position is greater than number of elements) in content of all entries of input matched by
# path. If not specified inserts at the end. # path. If not specified inserts at the end.
] { ] {
$in | xupdate $path {|entry| xupdate $path {|entry|
match ($entry | xtype) { match ($entry | xtype) {
'tag' => { 'tag' => {
let new_content = if $position == null { let new_content = if $position == null {