1
0
mirror of https://github.com/nushell/nushell.git synced 2025-05-12 05:54:27 +02:00
nushell/crates/nu-command/tests/commands/debug
Ian Manske 7d2e8875e0
Make timeit take only closures as an argument ()
# Description

Fixes  where expressions passed to `timeit` will execute twice.
This PR removes the expression support for `timeit`, as this behavior is
almost exclusive to `timeit` and can hinder migration to the IR
evaluator in the future. Additionally, `timeit` used to be able to take
a `block` as an argument. Blocks should probably only be allowed for
parser keywords, so this PR changes `timeit` to instead only take
closures as an argument. This also fixes an issue where environment
updates inside the `timeit` block would affect the parent scope and all
commands later in the pipeline.

```nu
> timeit { $env.FOO = 'bar' }; print $env.FOO
bar
```

# User-Facing Changes

`timeit` now only takes a closure as the first argument.

# After Submitting

Update examples in the book/docs if necessary.
2024-12-10 23:08:53 +08:00
..
mod.rs Force timeit to not capture stdout () 2024-04-10 13:31:29 +00:00
timeit.rs Make timeit take only closures as an argument () 2024-12-10 23:08:53 +08:00