From 59c8a279daf6912b99ba089ff6dafbfc3469831e Mon Sep 17 00:00:00 2001 From: ljedrz Date: Thu, 26 Jul 2018 17:11:10 +0200 Subject: Replace push loops with collect() and extend() where possible --- src/libstd/sys/windows/process.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/libstd/sys/windows') diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index be442f41374..4974a8de89c 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -487,9 +487,7 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> io::Result> { } else { if x == '"' as u16 { // Add n+1 backslashes to total 2n+1 before internal '"'. - for _ in 0..(backslashes+1) { - cmd.push('\\' as u16); - } + cmd.extend((0..(backslashes + 1)).map(|_| '\\' as u16)); } backslashes = 0; } @@ -498,9 +496,7 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> io::Result> { if quote { // Add n backslashes to total 2n before ending '"'. - for _ in 0..backslashes { - cmd.push('\\' as u16); - } + cmd.extend((0..backslashes).map(|_| '\\' as u16)); cmd.push('"' as u16); } Ok(()) -- cgit 1.4.1-3-g733a5