Repository: clap-rs/clap (language: rust)

Issue:
Rustdoc is not scraping examples
The `-Zrustdoc-scrape-examples` flag is being [ignored on docs.rs](https://docs.rs/crate/clap/4.5.16/builds/1325757) due to rust-lang/cargo#11430, which requires users to explicitly indicate that examples which rely on dev-dependencies should be scraped. (This avoids breakage because `cargo doc` does not normally require dev-dependencies.)

If the maintainers still want to use this feature, you can add `doc-scrape-examples = true` to one `[[example]]` configuration, for instance:

```toml
[[example]]
name = "demo"
required-features = ["derive"]
doc-scrape-examples = true
```


Discussion / hints:

Fix patch:
diff --git a/Cargo.toml b/Cargo.toml
index dc72812dce6..11b5af630e9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -193,263 +193,317 @@ clap-cargo = { version = "0.14.1", default-features = false }
 [[example]]
 name = "demo"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "cargo-example"
 required-features = ["cargo", "color"]
+doc-scrape-examples = true
 
 [[example]]
 name = "cargo-example-derive"
 required-features = ["derive", "color"]
+doc-scrape-examples = true
 
 [[example]]
 name = "escaped-positional"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "escaped-positional-derive"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "find"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "git-derive"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "typed-derive"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "busybox"
 path = "examples/multicall-busybox.rs"
+doc-scrape-examples = true
 
 [[example]]
 name = "hostname"
 path = "examples/multicall-hostname.rs"
+doc-scrape-examples = true
 
 [[example]]
 name = "repl"
 path = "examples/repl.rs"
 required-features = ["help"]
+doc-scrape-examples = true
 
 [[example]]
 name = "repl-derive"
 path = "examples/repl-derive.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "01_quick"
 path = "examples/tutorial_builder/01_quick.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "02_apps"
 path = "examples/tutorial_builder/02_apps.rs"
+doc-scrape-examples = true
 
 [[example]]
 name = "02_crate"
 path = "examples/tutorial_builder/02_crate.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "02_app_settings"
 path = "examples/tutorial_builder/02_app_settings.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_01_flag_bool"
 path = "examples/tutorial_builder/03_01_flag_bool.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_01_flag_count"
 path = "examples/tutorial_builder/03_01_flag_count.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_02_option"
 path = "examples/tutorial_builder/03_02_option.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_02_option_mult"
 path = "examples/tutorial_builder/03_02_option_mult.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_03_positional"
 path = "examples/tutorial_builder/03_03_positional.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_03_positional_mult"
 path = "examples/tutorial_builder/03_03_positional_mult.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_04_subcommands"
 path = "examples/tutorial_builder/03_04_subcommands.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_05_default_values"
 path = "examples/tutorial_builder/03_05_default_values.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_01_possible"
 path = "examples/tutorial_builder/04_01_possible.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_01_enum"
 path = "examples/tutorial_builder/04_01_enum.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_02_parse"
 path = "examples/tutorial_builder/04_02_parse.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_02_validate"
 path = "examples/tutorial_builder/04_02_validate.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_03_relations"
 path = "examples/tutorial_builder/04_03_relations.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_04_custom"
 path = "examples/tutorial_builder/04_04_custom.rs"
 required-features = ["cargo"]
+doc-scrape-examples = true
 
 [[example]]
 name = "05_01_assert"
 path = "examples/tutorial_builder/05_01_assert.rs"
 required-features = ["cargo"]
 test = true
+doc-scrape-examples = true
 
 [[example]]
 name = "01_quick_derive"
 path = "examples/tutorial_derive/01_quick.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "02_apps_derive"
 path = "examples/tutorial_derive/02_apps.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "02_crate_derive"
 path = "examples/tutorial_derive/02_crate.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "02_app_settings_derive"
 path = "examples/tutorial_derive/02_app_settings.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_01_flag_bool_derive"
 path = "examples/tutorial_derive/03_01_flag_bool.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_01_flag_count_derive"
 path = "examples/tutorial_derive/03_01_flag_count.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_02_option_derive"
 path = "examples/tutorial_derive/03_02_option.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_02_option_mult_derive"
 path = "examples/tutorial_derive/03_02_option_mult.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_03_positional_derive"
 path = "examples/tutorial_derive/03_03_positional.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_03_positional_mult_derive"
 path = "examples/tutorial_derive/03_03_positional_mult.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_04_subcommands_derive"
 path = "examples/tutorial_derive/03_04_subcommands.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_04_subcommands_alt_derive"
 path = "examples/tutorial_derive/03_04_subcommands_alt.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "03_05_default_values_derive"
 path = "examples/tutorial_derive/03_05_default_values.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_01_enum_derive"
 path = "examples/tutorial_derive/04_01_enum.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_02_parse_derive"
 path = "examples/tutorial_derive/04_02_parse.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_02_validate_derive"
 path = "examples/tutorial_derive/04_02_validate.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_03_relations_derive"
 path = "examples/tutorial_derive/04_03_relations.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "04_04_custom_derive"
 path = "examples/tutorial_derive/04_04_custom.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "05_01_assert_derive"
 path = "examples/tutorial_derive/05_01_assert.rs"
 required-features = ["derive"]
 test = true
+doc-scrape-examples = true
 
 [[example]]
 name = "interop_augment_args"
 path = "examples/derive_ref/augment_args.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "interop_augment_subcommands"
 path = "examples/derive_ref/augment_subcommands.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "interop_hand_subcommand"
 path = "examples/derive_ref/hand_subcommand.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [[example]]
 name = "interop_flatten_hand_args"
 path = "examples/derive_ref/flatten_hand_args.rs"
 required-features = ["derive"]
+doc-scrape-examples = true
 
 [profile.test]
 opt-level = 1


Test patch: