mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Change the ignore command to use drain() instead of collecting a value (#12120)
# Description Change the `ignore` command to use `drain()` instead of collecting a value. This saves memory usage when piping a lot of output to `ignore`. There's no reason to keep the output in memory if it's going to be discarded anyway. # User-Facing Changes Probably none # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib`
This commit is contained in:
7
crates/nu-command/tests/commands/ignore.rs
Normal file
7
crates/nu-command/tests/commands/ignore.rs
Normal file
@ -0,0 +1,7 @@
|
||||
use nu_test_support::nu;
|
||||
|
||||
#[test]
|
||||
fn ignore_still_causes_stream_to_be_consumed_fully() {
|
||||
let result = nu!("[foo bar] | each { |val| print $val; $val } | ignore");
|
||||
assert_eq!("foobar", result.out);
|
||||
}
|
@ -45,6 +45,7 @@ mod hash_;
|
||||
mod headers;
|
||||
mod help;
|
||||
mod histogram;
|
||||
mod ignore;
|
||||
mod insert;
|
||||
mod inspect;
|
||||
mod interleave;
|
||||
|
Reference in New Issue
Block a user