mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 08:45:45 +02:00
Use iterator chain instead of string concat. (#2655)
* Use iterator chain instead of string concat * Add regression test for multi-value lines
This commit is contained in:
@ -75,9 +75,9 @@ async fn lines(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputSt
|
||||
} => {
|
||||
let mut leftover_string = leftover_string.lock();
|
||||
|
||||
let st = (&*leftover_string).clone() + &st;
|
||||
|
||||
let mut lines: Vec<String> = st.lines().map(|x| x.to_string()).collect();
|
||||
let lo_lines = (&*leftover_string).lines().map(|x| x.to_string());
|
||||
let st_lines = st.lines().map(|x| x.to_string());
|
||||
let mut lines: Vec<String> = lo_lines.chain(st_lines).collect();
|
||||
|
||||
leftover_string.clear();
|
||||
|
||||
|
Reference in New Issue
Block a user