mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
Remove some unnecessary static Vec
s (#11947)
Avoid unnecessary allocations or larger iterator structs - Turn static `Vec`s into arrays when possible - Use `std::iter::once`/`empty` where applicable - Use `bool::then_some` in `detect column` `.chain` - Drop in the bucket: de-vec-ing tests
This commit is contained in:
committed by
GitHub
parent
098527b263
commit
7884de1941
@ -154,9 +154,9 @@ impl Command for Do {
|
||||
let ctrlc = stdout_stream.ctrlc.clone();
|
||||
let span = stdout_stream.span;
|
||||
RawStream::new(
|
||||
Box::new(
|
||||
vec![stdout_stream.into_bytes().map(|s| s.item)].into_iter(),
|
||||
),
|
||||
Box::new(std::iter::once(
|
||||
stdout_stream.into_bytes().map(|s| s.item),
|
||||
)),
|
||||
ctrlc,
|
||||
span,
|
||||
None,
|
||||
@ -213,7 +213,7 @@ impl Command for Do {
|
||||
Ok(PipelineData::ExternalStream {
|
||||
stdout,
|
||||
stderr: Some(RawStream::new(
|
||||
Box::new(vec![Ok(stderr_msg.into_bytes())].into_iter()),
|
||||
Box::new(std::iter::once(Ok(stderr_msg.into_bytes()))),
|
||||
stderr_ctrlc,
|
||||
span,
|
||||
None,
|
||||
|
Reference in New Issue
Block a user