@@ -29,22 +29,14 @@ fn unimplemented_flags_should_error_non_linux() {
29
29
"noctty" ,
30
30
"nofollow" ,
31
31
] {
32
- let args = vec ! [ format!( "iflag={flag}" ) ] ;
33
-
34
- if Parser :: new ( )
35
- . parse ( & args. iter ( ) . map ( AsRef :: as_ref) . collect :: < Vec < _ > > ( ) [ ..] )
36
- . is_ok ( )
37
- {
38
- succeeded. push ( format ! ( "iflag={flag}" ) ) ;
32
+ let arg = format ! ( "iflag={flag}" ) ;
33
+ if Parser :: new ( ) . parse ( [ & arg] ) . is_ok ( ) {
34
+ succeeded. push ( arg) ;
39
35
}
40
36
41
- let args = vec ! [ format!( "oflag={flag}" ) ] ;
42
-
43
- if Parser :: new ( )
44
- . parse ( & args. iter ( ) . map ( AsRef :: as_ref) . collect :: < Vec < _ > > ( ) [ ..] )
45
- . is_ok ( )
46
- {
47
- succeeded. push ( format ! ( "iflag={flag}" ) ) ;
37
+ let arg = format ! ( "oflag={flag}" ) ;
38
+ if Parser :: new ( ) . parse ( [ & arg] ) . is_ok ( ) {
39
+ succeeded. push ( arg) ;
48
40
}
49
41
}
50
42
@@ -61,22 +53,14 @@ fn unimplemented_flags_should_error() {
61
53
62
54
// The following flags are not implemented
63
55
for flag in [ "cio" , "nolinks" , "text" , "binary" ] {
64
- let args = vec ! [ format!( "iflag={flag}" ) ] ;
65
-
66
- if Parser :: new ( )
67
- . parse ( & args. iter ( ) . map ( AsRef :: as_ref) . collect :: < Vec < _ > > ( ) [ ..] )
68
- . is_ok ( )
69
- {
70
- succeeded. push ( format ! ( "iflag={flag}" ) ) ;
56
+ let arg = format ! ( "iflag={flag}" ) ;
57
+ if Parser :: new ( ) . parse ( [ & arg] ) . is_ok ( ) {
58
+ succeeded. push ( arg) ;
71
59
}
72
60
73
- let args = vec ! [ format!( "oflag={flag}" ) ] ;
74
-
75
- if Parser :: new ( )
76
- . parse ( & args. iter ( ) . map ( AsRef :: as_ref) . collect :: < Vec < _ > > ( ) [ ..] )
77
- . is_ok ( )
78
- {
79
- succeeded. push ( format ! ( "iflag={flag}" ) ) ;
61
+ let arg = format ! ( "oflag={flag}" ) ;
62
+ if Parser :: new ( ) . parse ( [ & arg] ) . is_ok ( ) {
63
+ succeeded. push ( arg) ;
80
64
}
81
65
}
82
66
@@ -88,14 +72,14 @@ fn unimplemented_flags_should_error() {
88
72
89
73
#[ test]
90
74
fn test_status_level_absent ( ) {
91
- let args = & [ "if=foo.file" , "of=bar.file" ] ;
75
+ let args = [ "if=foo.file" , "of=bar.file" ] ;
92
76
93
77
assert_eq ! ( Parser :: new( ) . parse( args) . unwrap( ) . status, None ) ;
94
78
}
95
79
96
80
#[ test]
97
81
fn test_status_level_none ( ) {
98
- let args = & [ "status=none" , "if=foo.file" , "of=bar.file" ] ;
82
+ let args = [ "status=none" , "if=foo.file" , "of=bar.file" ] ;
99
83
100
84
assert_eq ! (
101
85
Parser :: new( ) . parse( args) . unwrap( ) . status,
@@ -106,7 +90,7 @@ fn test_status_level_none() {
106
90
#[ test]
107
91
#[ allow( clippy:: cognitive_complexity) ]
108
92
fn test_all_top_level_args_no_leading_dashes ( ) {
109
- let args = & [
93
+ let args = [
110
94
"if=foo.file" ,
111
95
"of=bar.file" ,
112
96
"ibs=10" ,
@@ -181,7 +165,7 @@ fn test_all_top_level_args_no_leading_dashes() {
181
165
182
166
#[ test]
183
167
fn test_status_level_progress ( ) {
184
- let args = & [ "if=foo.file" , "of=bar.file" , "status=progress" ] ;
168
+ let args = [ "if=foo.file" , "of=bar.file" , "status=progress" ] ;
185
169
186
170
let settings = Parser :: new ( ) . parse ( args) . unwrap ( ) ;
187
171
@@ -190,7 +174,7 @@ fn test_status_level_progress() {
190
174
191
175
#[ test]
192
176
fn test_status_level_noxfer ( ) {
193
- let args = & [ "if=foo.file" , "status=noxfer" , "of=bar.file" ] ;
177
+ let args = [ "if=foo.file" , "status=noxfer" , "of=bar.file" ] ;
194
178
195
179
let settings = Parser :: new ( ) . parse ( args) . unwrap ( ) ;
196
180
@@ -199,7 +183,7 @@ fn test_status_level_noxfer() {
199
183
200
184
#[ test]
201
185
fn test_multiple_flags_options ( ) {
202
- let args = & [
186
+ let args = [
203
187
"iflag=fullblock,count_bytes" ,
204
188
"iflag=skip_bytes" ,
205
189
"oflag=append" ,
@@ -246,7 +230,7 @@ fn test_multiple_flags_options() {
246
230
247
231
#[ test]
248
232
fn test_override_multiple_options ( ) {
249
- let args = & [
233
+ let args = [
250
234
"if=foo.file" ,
251
235
"if=correct.file" ,
252
236
"of=bar.file" ,
@@ -288,31 +272,31 @@ fn test_override_multiple_options() {
288
272
289
273
#[ test]
290
274
fn icf_ctable_error ( ) {
291
- let args = & [ "conv=ascii,ebcdic,ibm" ] ;
275
+ let args = [ "conv=ascii,ebcdic,ibm" ] ;
292
276
assert ! ( Parser :: new( ) . parse( args) . is_err( ) ) ;
293
277
}
294
278
295
279
#[ test]
296
280
fn icf_case_error ( ) {
297
- let args = & [ "conv=ucase,lcase" ] ;
281
+ let args = [ "conv=ucase,lcase" ] ;
298
282
assert ! ( Parser :: new( ) . parse( args) . is_err( ) ) ;
299
283
}
300
284
301
285
#[ test]
302
286
fn icf_block_error ( ) {
303
- let args = & [ "conv=block,unblock" ] ;
287
+ let args = [ "conv=block,unblock" ] ;
304
288
assert ! ( Parser :: new( ) . parse( args) . is_err( ) ) ;
305
289
}
306
290
307
291
#[ test]
308
292
fn icf_creat_error ( ) {
309
- let args = & [ "conv=excl,nocreat" ] ;
293
+ let args = [ "conv=excl,nocreat" ] ;
310
294
assert ! ( Parser :: new( ) . parse( args) . is_err( ) ) ;
311
295
}
312
296
313
297
#[ test]
314
298
fn parse_icf_token_ibm ( ) {
315
- let args = & [ "conv=ibm" ] ;
299
+ let args = [ "conv=ibm" ] ;
316
300
let settings = Parser :: new ( ) . parse ( args) . unwrap ( ) ;
317
301
318
302
assert_eq ! (
@@ -326,7 +310,7 @@ fn parse_icf_token_ibm() {
326
310
327
311
#[ test]
328
312
fn parse_icf_tokens_elu ( ) {
329
- let args = & [ "conv=ebcdic,lcase" ] ;
313
+ let args = [ "conv=ebcdic,lcase" ] ;
330
314
let settings = Parser :: new ( ) . parse ( args) . unwrap ( ) ;
331
315
332
316
assert_eq ! (
@@ -340,7 +324,7 @@ fn parse_icf_tokens_elu() {
340
324
341
325
#[ test]
342
326
fn parse_icf_tokens_remaining ( ) {
343
- let args = & [
327
+ let args = [
344
328
"conv=ascii,ucase,block,sparse,swab,sync,noerror,excl,nocreat,notrunc,noerror,fdatasync,fsync" ,
345
329
] ;
346
330
assert_eq ! (
@@ -369,7 +353,7 @@ fn parse_icf_tokens_remaining() {
369
353
370
354
#[ test]
371
355
fn parse_iflag_tokens ( ) {
372
- let args = & [ "iflag=fullblock,count_bytes,skip_bytes" ] ;
356
+ let args = [ "iflag=fullblock,count_bytes,skip_bytes" ] ;
373
357
assert_eq ! (
374
358
Parser :: new( ) . read( args) ,
375
359
Ok ( Parser {
@@ -386,7 +370,7 @@ fn parse_iflag_tokens() {
386
370
387
371
#[ test]
388
372
fn parse_oflag_tokens ( ) {
389
- let args = & [ "oflag=append,seek_bytes" ] ;
373
+ let args = [ "oflag=append,seek_bytes" ] ;
390
374
assert_eq ! (
391
375
Parser :: new( ) . read( args) ,
392
376
Ok ( Parser {
@@ -403,7 +387,7 @@ fn parse_oflag_tokens() {
403
387
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
404
388
#[ test]
405
389
fn parse_iflag_tokens_linux ( ) {
406
- let args = & [ "iflag=direct,directory,dsync,sync,nonblock,noatime,noctty,nofollow" ] ;
390
+ let args = [ "iflag=direct,directory,dsync,sync,nonblock,noatime,noctty,nofollow" ] ;
407
391
assert_eq ! (
408
392
Parser :: new( ) . read( args) ,
409
393
Ok ( Parser {
@@ -426,7 +410,7 @@ fn parse_iflag_tokens_linux() {
426
410
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
427
411
#[ test]
428
412
fn parse_oflag_tokens_linux ( ) {
429
- let args = & [ "oflag=direct,directory,dsync,sync,nonblock,noatime,noctty,nofollow" ] ;
413
+ let args = [ "oflag=direct,directory,dsync,sync,nonblock,noatime,noctty,nofollow" ] ;
430
414
assert_eq ! (
431
415
Parser :: new( ) . read( args) ,
432
416
Ok ( Parser {
0 commit comments