Skip to content

Commit ae1ce7d

Browse files
jimblandykulp
authored andcommitted
Don't use Arg::takes_value when it's implied by other calls.
Both `Arg::value_name` and `Arg::number_of_values` imply `Arg::takes_value`, so those calls are just noise.
1 parent 6df6d0a commit ae1ce7d

File tree

1 file changed

+3
-33
lines changed

1 file changed

+3
-33
lines changed

src/options.rs

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,18 @@ where
5555
bitfield flags.",
5656
)
5757
.value_name("regex")
58-
.takes_value(true)
5958
.multiple_occurrences(true)
6059
.number_of_values(1),
6160
Arg::new("newtype-enum")
6261
.long("newtype-enum")
6362
.help("Mark any enum whose name matches <regex> as a newtype.")
6463
.value_name("regex")
65-
.takes_value(true)
6664
.multiple_occurrences(true)
6765
.number_of_values(1),
6866
Arg::new("rustified-enum")
6967
.long("rustified-enum")
7068
.help("Mark any enum whose name matches <regex> as a Rust enum.")
7169
.value_name("regex")
72-
.takes_value(true)
7370
.multiple_occurrences(true)
7471
.number_of_values(1),
7572
Arg::new("constified-enum")
@@ -79,7 +76,6 @@ where
7976
constants.",
8077
)
8178
.value_name("regex")
82-
.takes_value(true)
8379
.multiple_occurrences(true)
8480
.number_of_values(1),
8581
Arg::new("constified-enum-module")
@@ -89,7 +85,6 @@ where
8985
constants.",
9086
)
9187
.value_name("regex")
92-
.takes_value(true)
9388
.multiple_occurrences(true)
9489
.number_of_values(1),
9590
Arg::new("default-macro-constant-type")
@@ -117,7 +112,6 @@ where
117112
normal type aliasing.",
118113
)
119114
.value_name("regex")
120-
.takes_value(true)
121115
.multiple_occurrences(true)
122116
.number_of_values(1),
123117
Arg::new("new-type-alias")
@@ -127,7 +121,6 @@ where
127121
a new type generated for it.",
128122
)
129123
.value_name("regex")
130-
.takes_value(true)
131124
.multiple_occurrences(true)
132125
.number_of_values(1),
133126
Arg::new("new-type-alias-deref")
@@ -137,39 +130,34 @@ where
137130
a new type with Deref and DerefMut to the inner type.",
138131
)
139132
.value_name("regex")
140-
.takes_value(true)
141133
.multiple_occurrences(true)
142134
.number_of_values(1),
143135
Arg::new("blocklist-type")
144136
.alias("blacklist-type")
145137
.long("blocklist-type")
146138
.help("Mark <type> as hidden.")
147139
.value_name("type")
148-
.takes_value(true)
149140
.multiple_occurrences(true)
150141
.number_of_values(1),
151142
Arg::new("blocklist-function")
152143
.alias("blacklist-function")
153144
.long("blocklist-function")
154145
.help("Mark <function> as hidden.")
155146
.value_name("function")
156-
.takes_value(true)
157147
.multiple_occurrences(true)
158148
.number_of_values(1),
159149
Arg::new("blocklist-item")
160150
.alias("blacklist-item")
161151
.long("blocklist-item")
162152
.help("Mark <item> as hidden.")
163153
.value_name("item")
164-
.takes_value(true)
165154
.multiple_occurrences(true)
166155
.number_of_values(1),
167156
Arg::new("blocklist-file")
168157
.alias("blacklist-file")
169158
.long("blocklist-file")
170159
.help("Mark all contents of <path> as hidden.")
171160
.value_name("path")
172-
.takes_value(true)
173161
.multiple_occurrences(true)
174162
.number_of_values(1),
175163
Arg::new("no-layout-tests")
@@ -256,14 +244,12 @@ where
256244
"Use the given prefix before raw types instead of \
257245
::std::os::raw.",
258246
)
259-
.value_name("prefix")
260-
.takes_value(true),
247+
.value_name("prefix"),
261248
Arg::new("anon-fields-prefix")
262249
.long("anon-fields-prefix")
263250
.help("Use the given prefix for the anon fields.")
264251
.value_name("prefix")
265-
.default_value(DEFAULT_ANON_FIELDS_PREFIX)
266-
.takes_value(true),
252+
.default_value(DEFAULT_ANON_FIELDS_PREFIX),
267253
Arg::new("time-phases")
268254
.long("time-phases")
269255
.help("Time the different bindgen phases and print to stderr"),
@@ -278,8 +264,7 @@ where
278264
Arg::new("emit-ir-graphviz")
279265
.long("emit-ir-graphviz")
280266
.help("Dump graphviz dot file.")
281-
.value_name("path")
282-
.takes_value(true),
267+
.value_name("path"),
283268
Arg::new("enable-cxx-namespaces")
284269
.long("enable-cxx-namespaces")
285270
.help("Enable support for C++ namespaces."),
@@ -343,7 +328,6 @@ where
343328
.long("opaque-type")
344329
.help("Mark <type> as opaque.")
345330
.value_name("type")
346-
.takes_value(true)
347331
.multiple_occurrences(true)
348332
.number_of_values(1),
349333
Arg::new("output")
@@ -354,13 +338,11 @@ where
354338
Arg::new("raw-line")
355339
.long("raw-line")
356340
.help("Add a raw line of Rust code at the beginning of output.")
357-
.takes_value(true)
358341
.multiple_occurrences(true)
359342
.number_of_values(1),
360343
Arg::new("module-raw-line")
361344
.long("module-raw-line")
362345
.help("Add a raw line of Rust code to a given module.")
363-
.takes_value(true)
364346
.multiple_occurrences(true)
365347
.number_of_values(2)
366348
.value_names(&["module-name", "raw-line"]),
@@ -389,7 +371,6 @@ where
389371
generated.",
390372
)
391373
.value_name("regex")
392-
.takes_value(true)
393374
.multiple_occurrences(true)
394375
.number_of_values(1),
395376
Arg::new("generate-inline-functions")
@@ -403,7 +384,6 @@ where
403384
not be generated.",
404385
)
405386
.value_name("regex")
406-
.takes_value(true)
407387
.multiple_occurrences(true)
408388
.number_of_values(1),
409389
Arg::new("allowlist-var")
@@ -415,15 +395,13 @@ where
415395
generated.",
416396
)
417397
.value_name("regex")
418-
.takes_value(true)
419398
.multiple_occurrences(true)
420399
.number_of_values(1),
421400
Arg::new("allowlist-file")
422401
.alias("allowlist-file")
423402
.long("allowlist-file")
424403
.help("Allowlist all contents of <path>.")
425404
.value_name("path")
426-
.takes_value(true)
427405
.multiple_occurrences(true)
428406
.number_of_values(1),
429407
Arg::new("verbose")
@@ -464,49 +442,42 @@ where
464442
This parameter is incompatible with --no-rustfmt-bindings.",
465443
)
466444
.value_name("path")
467-
.takes_value(true)
468445
.multiple_occurrences(false)
469446
.number_of_values(1),
470447
Arg::new("no-partialeq")
471448
.long("no-partialeq")
472449
.help("Avoid deriving PartialEq for types matching <regex>.")
473450
.value_name("regex")
474-
.takes_value(true)
475451
.multiple_occurrences(true)
476452
.number_of_values(1),
477453
Arg::new("no-copy")
478454
.long("no-copy")
479455
.help("Avoid deriving Copy for types matching <regex>.")
480456
.value_name("regex")
481-
.takes_value(true)
482457
.multiple_occurrences(true)
483458
.number_of_values(1),
484459
Arg::new("no-debug")
485460
.long("no-debug")
486461
.help("Avoid deriving Debug for types matching <regex>.")
487462
.value_name("regex")
488-
.takes_value(true)
489463
.multiple_occurrences(true)
490464
.number_of_values(1),
491465
Arg::new("no-default")
492466
.long("no-default")
493467
.help("Avoid deriving/implement Default for types matching <regex>.")
494468
.value_name("regex")
495-
.takes_value(true)
496469
.multiple_occurrences(true)
497470
.number_of_values(1),
498471
Arg::new("no-hash")
499472
.long("no-hash")
500473
.help("Avoid deriving Hash for types matching <regex>.")
501474
.value_name("regex")
502-
.takes_value(true)
503475
.multiple_occurrences(true)
504476
.number_of_values(1),
505477
Arg::new("must-use-type")
506478
.long("must-use-type")
507479
.help("Add #[must_use] annotation to types matching <regex>.")
508480
.value_name("regex")
509-
.takes_value(true)
510481
.multiple_occurrences(true)
511482
.number_of_values(1),
512483
Arg::new("enable-function-attribute-detection")
@@ -521,7 +492,6 @@ where
521492
Arg::new("wasm-import-module-name")
522493
.long("wasm-import-module-name")
523494
.value_name("name")
524-
.takes_value(true)
525495
.help("The name to be used in a #[link(wasm_import_module = ...)] statement"),
526496
Arg::new("dynamic-loading")
527497
.long("dynamic-loading")

0 commit comments

Comments
 (0)