From 05a22a72e4574b2105c0a190d7a4bd4a84da16ee Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 10 Dec 2018 15:37:50 -0700 Subject: Fix nits Add comments explaining how we test this, and use a slice for debugging instead of a clone of the iterator. --- src/libstd/sys/windows/args.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/libstd/sys/windows') diff --git a/src/libstd/sys/windows/args.rs b/src/libstd/sys/windows/args.rs index 62ef7a7f0f6..fd93d389e43 100644 --- a/src/libstd/sys/windows/args.rs +++ b/src/libstd/sys/windows/args.rs @@ -35,13 +35,20 @@ pub fn args() -> Args { } } -/// Implements the Windows command-line argument parsing algorithm, described at +/// Implements the Windows command-line argument parsing algorithm. +/// +/// Microsoft's documentation for the Windows CLI argument format can be found at /// . /// /// Windows includes a function to do this in shell32.dll, /// but linking with that DLL causes the process to be registered as a GUI application. /// GUI applications add a bunch of overhead, even if no windows are drawn. See /// . +/// +/// This function was tested for equivalence to the shell32.dll implementation in +/// Windows 10 Pro v1803, using an exhaustive test suite available at +/// or +/// . unsafe fn parse_lp_cmd_line OsString>(lp_cmd_line: *const u16, exe_name: F) -> vec::IntoIter { const BACKSLASH: u16 = '\\' as u16; @@ -176,13 +183,13 @@ impl<'a> fmt::Debug for ArgsInnerDebug<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("[")?; let mut first = true; - for i in self.args.parsed_args_list.clone() { + for i in self.args.parsed_args_list.as_slice() { if !first { f.write_str(", ")?; } first = false; - fmt::Debug::fmt(&i, f)?; + fmt::Debug::fmt(i, f)?; } f.write_str("]")?; Ok(()) -- cgit 1.4.1-3-g733a5