Skip to content

Commit 5302539

Browse files
committed
Change all 'optflag' arguments to 'optflagmulti'
Because specifying these flags multiple times will never be discernibly different in functionality from specifying them a single time, there is no reason to fail and report an error to the user.
1 parent 8b87e85 commit 5302539

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

src/librustdoc/lib.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ fn opts() -> Vec<RustcOptGroup> {
269269
let stable: fn(_, fn(&mut getopts::Options) -> &mut _) -> _ = RustcOptGroup::stable;
270270
let unstable: fn(_, fn(&mut getopts::Options) -> &mut _) -> _ = RustcOptGroup::unstable;
271271
vec![
272-
stable("h", |o| o.optflag("h", "help", "show this help message")),
273-
stable("V", |o| o.optflag("V", "version", "print rustdoc's version")),
274-
stable("v", |o| o.optflag("v", "verbose", "use verbose output")),
272+
stable("h", |o| o.optflagmulti("h", "help", "show this help message")),
273+
stable("V", |o| o.optflagmulti("V", "version", "print rustdoc's version")),
274+
stable("v", |o| o.optflagmulti("v", "verbose", "use verbose output")),
275275
stable("r", |o| {
276276
o.optopt("r", "input-format", "the input type of the specified file", "[rust]")
277277
}),
@@ -309,14 +309,14 @@ fn opts() -> Vec<RustcOptGroup> {
309309
)
310310
}),
311311
stable("plugins", |o| o.optmulti("", "plugins", "removed", "PLUGINS")),
312-
stable("no-default", |o| o.optflag("", "no-defaults", "don't run the default passes")),
312+
stable("no-default", |o| o.optflagmulti("", "no-defaults", "don't run the default passes")),
313313
stable("document-private-items", |o| {
314-
o.optflag("", "document-private-items", "document private items")
314+
o.optflagmulti("", "document-private-items", "document private items")
315315
}),
316316
unstable("document-hidden-items", |o| {
317-
o.optflag("", "document-hidden-items", "document items that have doc(hidden)")
317+
o.optflagmulti("", "document-hidden-items", "document items that have doc(hidden)")
318318
}),
319-
stable("test", |o| o.optflag("", "test", "run code examples as tests")),
319+
stable("test", |o| o.optflagmulti("", "test", "run code examples as tests")),
320320
stable("test-args", |o| {
321321
o.optmulti("", "test-args", "arguments to pass to the test runner", "ARGS")
322322
}),
@@ -386,7 +386,7 @@ fn opts() -> Vec<RustcOptGroup> {
386386
o.optopt("", "markdown-playground-url", "URL to send code snippets to", "URL")
387387
}),
388388
stable("markdown-no-toc", |o| {
389-
o.optflag("", "markdown-no-toc", "don't include table of contents")
389+
o.optflagmulti("", "markdown-no-toc", "don't include table of contents")
390390
}),
391391
stable("e", |o| {
392392
o.optopt(
@@ -412,13 +412,13 @@ fn opts() -> Vec<RustcOptGroup> {
412412
)
413413
}),
414414
unstable("display-warnings", |o| {
415-
o.optflag("", "display-warnings", "to print code warnings when testing doc")
415+
o.optflagmulti("", "display-warnings", "to print code warnings when testing doc")
416416
}),
417417
stable("crate-version", |o| {
418418
o.optopt("", "crate-version", "crate version to print into documentation", "VERSION")
419419
}),
420420
unstable("sort-modules-by-appearance", |o| {
421-
o.optflag(
421+
o.optflagmulti(
422422
"",
423423
"sort-modules-by-appearance",
424424
"sort modules by where they appear in the program, rather than alphabetically",
@@ -495,7 +495,7 @@ fn opts() -> Vec<RustcOptGroup> {
495495
o.optopt("", "json", "Configure the structure of JSON diagnostics", "CONFIG")
496496
}),
497497
unstable("disable-minification", |o| {
498-
o.optflag("", "disable-minification", "Disable minification applied on JS files")
498+
o.optflagmulti("", "disable-minification", "Disable minification applied on JS files")
499499
}),
500500
stable("warn", |o| o.optmulti("W", "warn", "Set lint warnings", "OPT")),
501501
stable("allow", |o| o.optmulti("A", "allow", "Set lint allowed", "OPT")),
@@ -523,7 +523,7 @@ fn opts() -> Vec<RustcOptGroup> {
523523
o.optopt("", "index-page", "Markdown file to be used as index page", "PATH")
524524
}),
525525
unstable("enable-index-page", |o| {
526-
o.optflag("", "enable-index-page", "To enable generation of the index page")
526+
o.optflagmulti("", "enable-index-page", "To enable generation of the index page")
527527
}),
528528
unstable("static-root-path", |o| {
529529
o.optopt(
@@ -535,7 +535,7 @@ fn opts() -> Vec<RustcOptGroup> {
535535
)
536536
}),
537537
unstable("disable-per-crate-search", |o| {
538-
o.optflag(
538+
o.optflagmulti(
539539
"",
540540
"disable-per-crate-search",
541541
"disables generating the crate selector on the search box",
@@ -550,14 +550,14 @@ fn opts() -> Vec<RustcOptGroup> {
550550
)
551551
}),
552552
unstable("show-coverage", |o| {
553-
o.optflag(
553+
o.optflagmulti(
554554
"",
555555
"show-coverage",
556556
"calculate percentage of public items with documentation",
557557
)
558558
}),
559559
unstable("enable-per-target-ignores", |o| {
560-
o.optflag(
560+
o.optflagmulti(
561561
"",
562562
"enable-per-target-ignores",
563563
"parse ignore-foo for ignoring doctests on a per-target basis",

src/test/rustdoc/duplicate-flags.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// compile-flags: --document-private-items --document-private-items
2+
3+
// @has duplicate_flags/struct.Private.html
4+
struct Private;

0 commit comments

Comments
 (0)