@@ -35,13 +35,20 @@ pub fn args() -> Args {
35
35
}
36
36
}
37
37
38
- /// Implements the Windows command-line argument parsing algorithm, described at
38
+ /// Implements the Windows command-line argument parsing algorithm.
39
+ ///
40
+ /// Microsoft's documentation for the Windows CLI argument format can be found at
39
41
/// <https://docs.microsoft.com/en-us/previous-versions//17w5ykft(v=vs.85)>.
40
42
///
41
43
/// Windows includes a function to do this in shell32.dll,
42
44
/// but linking with that DLL causes the process to be registered as a GUI application.
43
45
/// GUI applications add a bunch of overhead, even if no windows are drawn. See
44
46
/// <https://randomascii.wordpress.com/2018/12/03/a-not-called-function-can-cause-a-5x-slowdown/>.
47
+ ///
48
+ /// This function was tested for equivalence to the shell32.dll implementation in
49
+ /// Windows 10 Pro v1803, using an exhaustive test suite available at
50
+ /// <https://gist.github.com/notriddle/dde431930c392e428055b2dc22e638f5> or
51
+ /// <https://paste.gg/p/anonymous/47d6ed5f5bd549168b1c69c799825223>.
45
52
unsafe fn parse_lp_cmd_line < F : Fn ( ) -> OsString > ( lp_cmd_line : * const u16 , exe_name : F )
46
53
-> vec:: IntoIter < OsString > {
47
54
const BACKSLASH : u16 = '\\' as u16 ;
@@ -176,13 +183,13 @@ impl<'a> fmt::Debug for ArgsInnerDebug<'a> {
176
183
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
177
184
f. write_str ( "[" ) ?;
178
185
let mut first = true ;
179
- for i in self . args . parsed_args_list . clone ( ) {
186
+ for i in self . args . parsed_args_list . as_slice ( ) {
180
187
if !first {
181
188
f. write_str ( ", " ) ?;
182
189
}
183
190
first = false ;
184
191
185
- fmt:: Debug :: fmt ( & i, f) ?;
192
+ fmt:: Debug :: fmt ( i, f) ?;
186
193
}
187
194
f. write_str ( "]" ) ?;
188
195
Ok ( ( ) )
0 commit comments