@@ -18,17 +18,6 @@ use crate::sys_common::AsInner;
1818use crate :: sys_common:: wstr:: WStrUnits ;
1919use crate :: { fmt, io, iter, vec} ;
2020
21- /// This is the const equivalent to `NonZero::new(n).unwrap()`
22- ///
23- /// FIXME(const-hack): This can be removed once `Option::unwrap` is stably const.
24- /// See the `const_option` feature (#67441).
25- const fn non_zero_u16 ( n : u16 ) -> NonZero < u16 > {
26- match NonZero :: new ( n) {
27- Some ( n) => n,
28- None => panic ! ( "called `unwrap` on a `None` value" ) ,
29- }
30- }
31-
3221pub fn args ( ) -> Args {
3322 // SAFETY: `GetCommandLineW` returns a pointer to a null terminated UTF-16
3423 // string so it's safe for `WStrUnits` to use.
@@ -66,10 +55,10 @@ fn parse_lp_cmd_line<'a, F: Fn() -> OsString>(
6655 lp_cmd_line : Option < WStrUnits < ' a > > ,
6756 exe_name : F ,
6857) -> Vec < OsString > {
69- const BACKSLASH : NonZero < u16 > = non_zero_u16 ( b'\\' as u16 ) ;
70- const QUOTE : NonZero < u16 > = non_zero_u16 ( b'"' as u16 ) ;
71- const TAB : NonZero < u16 > = non_zero_u16 ( b'\t' as u16 ) ;
72- const SPACE : NonZero < u16 > = non_zero_u16 ( b' ' as u16 ) ;
58+ const BACKSLASH : NonZero < u16 > = NonZero :: new ( b'\\' as u16 ) . unwrap ( ) ;
59+ const QUOTE : NonZero < u16 > = NonZero :: new ( b'"' as u16 ) . unwrap ( ) ;
60+ const TAB : NonZero < u16 > = NonZero :: new ( b'\t' as u16 ) . unwrap ( ) ;
61+ const SPACE : NonZero < u16 > = NonZero :: new ( b' ' as u16 ) . unwrap ( ) ;
7362
7463 let mut ret_val = Vec :: new ( ) ;
7564 // If the cmd line pointer is null or it points to an empty string then
0 commit comments