mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 06:30:08 +02:00
fix do closure with both required, options, and rest args (#13002)
# Description Fixes: #12985 `val_iter` has already handle required positional and optional positional arguments, it not skip them again while handling rest arguments. # User-Facing Changes Makes `do {|a, ...b| echo $a ...$b} 1 2 3 4` output the following again: ```nushell ╭───┬───╮ │ 0 │ 1 │ │ 1 │ 2 │ │ 2 │ 3 │ │ 3 │ 4 │ ╰───┴───╯ ``` # Tests + Formatting Added some test cases
This commit is contained in:
@ -298,9 +298,7 @@ fn bind_args_to(
|
||||
if let Some(rest_positional) = &signature.rest_positional {
|
||||
let mut rest_items = vec![];
|
||||
|
||||
for result in
|
||||
val_iter.skip(signature.required_positional.len() + signature.optional_positional.len())
|
||||
{
|
||||
for result in val_iter {
|
||||
rest_items.push(result);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user