mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 15:39:06 +01:00
Simplify and reduce allocations in pipeline data loop (#6790)
This commit is contained in:
parent
7336e1df1a
commit
50e53e788a
@ -185,29 +185,17 @@ impl PipelineData {
|
||||
PipelineData::ExternalStream {
|
||||
stdout: Some(s), ..
|
||||
} => {
|
||||
let mut items = vec![];
|
||||
let mut output = String::new();
|
||||
|
||||
for val in s {
|
||||
match val {
|
||||
Ok(val) => {
|
||||
items.push(val);
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(e);
|
||||
}
|
||||
Ok(val) => match val.as_string() {
|
||||
Ok(s) => output.push_str(&s),
|
||||
Err(err) => return Err(err),
|
||||
},
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
}
|
||||
|
||||
let mut output = String::new();
|
||||
for item in items {
|
||||
match item.as_string() {
|
||||
Ok(s) => output.push_str(&s),
|
||||
Err(err) => {
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(output)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user