Repository: clap-rs/clap
Pull request #4514 (2022-11-27 16:16:47)

docs: Present other environment variable alternatives to `crate_name!`
This PR will add a note to the description on `crate_name!` macro about where the name in the output come from.

There are 3 name-related environment variables in cargo, `CARGO_PKG_NAME`, `CARGO_CRATE_NAME`, and `CARGO_BIN_NAME`, and the `crate_name!` macro uses the 1st one among them.  This means that `foo` is used as the name in the case of Cargo.toml as shown below:

```toml
[package]
name = "foo"

[[bin]]
name = "bar"
```

Since the `crate_*` macros are under consideration for deprecation in #2840, and changing the source to another environment variable would result in the behavior change, I think it would be best to add a note to the documentation.

If you have suggestions, I would appreciate it.
Thank you very much.


Patch:
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000..97ff7438
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,17 @@
+version: 2
+updates:
+- package-ecosystem: cargo
+  directory: "/"
+  schedule:
+    interval: monthly
+    time: "07:00"
+  open-pull-requests-limit: 10
+  labels:
+    - C-dependencies
+- package-ecosystem: "github-actions"
+  directory: "/"
+  schedule: 
+    interval: monthly
+  open-pull-requests-limit: 10
+  labels: 
+   - "C-dependencies"
diff --git a/.github/renovate.json5 b/.github/renovate.json5
deleted file mode 100644
index 53161baf..00000000
--- a/.github/renovate.json5
+++ /dev/null
@@ -1,45 +0,0 @@
-{
-  "schedule": [
-    "before 3am on the first day of the month"
-  ],
-  "semanticCommits": "enabled",
-  "configMigration": true,
-  "packageRules": [
-    // Goals:
-    // - Keep version reqs low, ignoring compatible normal/build dependencies
-    // - Take advantage of latest dev-dependencies
-    // - Rollup safe upgrades to reduce CI runner load
-    // - Help keep number of versions down by always using latest breaking change
-    // - Have lockfile and manifest in-sync
-    {
-      "matchManagers": ["cargo"],
-      "matchDepTypes": ["build-dependencies", "dependencies"],
-      "matchCurrentVersion": ">=0.1.0",
-      "matchUpdateTypes": ["patch"],
-      "enabled": false,
-    },
-    {
-      "matchManagers": ["cargo"],
-      "matchDepTypes": ["build-dependencies", "dependencies"],
-      "matchCurrentVersion": ">=1.0.0",
-      "matchUpdateTypes": ["minor"],
-      "enabled": false,
-    },
-    {
-      "matchManagers": ["cargo"],
-      "matchDepTypes": ["dev-dependencies"],
-      "matchCurrentVersion": ">=0.1.0",
-      "matchUpdateTypes": ["patch"],
-      "automerge": true,
-      "groupName": "compatible (dev)",
-    },
-    {
-      "matchManagers": ["cargo"],
-      "matchDepTypes": ["dev-dependencies"],
-      "matchCurrentVersion": ">=1.0.0",
-      "matchUpdateTypes": ["minor"],
-      "automerge": true,
-      "groupName": "compatible (dev)",
-    },
-  ],
-}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c1e45b8e..1a46dfcc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -59,7 +59,7 @@ jobs:
         toolchain: ${{ matrix.rust }}
         profile: minimal
         override: true
-    - uses: Swatinem/rust-cache@v2
+    - uses: Swatinem/rust-cache@v1
     - name: Build
       run: make build-${{matrix.features}}
     - name: Test
@@ -106,7 +106,7 @@ jobs:
           toolchain: ${{ matrix.rust }}
           target: ${{ matrix.target }}
           override: true
-      - uses: Swatinem/rust-cache@v2
+      - uses: Swatinem/rust-cache@v1
       - name: Check
         run: make check-${{ matrix.features }}
   ui:
@@ -125,7 +125,7 @@ jobs:
         toolchain: 1.60.0  # MSRV
         profile: minimal
         override: true
-    - uses: Swatinem/rust-cache@v2
+    - uses: Swatinem/rust-cache@v1
     - name: UI Tests
       run: make test-ui-${{ matrix.features }}
   docs:
@@ -140,7 +140,7 @@ jobs:
         toolchain: 1.60.0  # MSRV
         profile: minimal
         override: true
-    - uses: Swatinem/rust-cache@v2
+    - uses: Swatinem/rust-cache@v1
     - name: Check documentation
       env:
         RUSTDOCFLAGS: -D warnings
@@ -160,7 +160,7 @@ jobs:
         profile: minimal
         override: true
         components: rustfmt
-    - uses: Swatinem/rust-cache@v2
+    - uses: Swatinem/rust-cache@v1
     - name: Check formatting
       run: cargo fmt --all -- --check
   clippy:
@@ -176,7 +176,7 @@ jobs:
         profile: minimal
         override: true
         components: clippy
-    - uses: Swatinem/rust-cache@v2
+    - uses: Swatinem/rust-cache@v1
     - name: Lint (ultra-minimal)
       run: make clippy-minimal ARGS='--manifest-path Cargo.toml'
     - name: Lint (minimal)
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 314f0844..05c39619 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -11,5 +11,5 @@ jobs:
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v3
-    - uses: actions/setup-python@v4
+    - uses: actions/setup-python@v3
     - uses: pre-commit/action@v3.0.0
diff --git a/.github/workflows/rust-next.yml b/.github/workflows/rust-next.yml
index 8000788b..dac1e4e2 100644
--- a/.github/workflows/rust-next.yml
+++ b/.github/workflows/rust-next.yml
@@ -55,7 +55,7 @@ jobs:
         toolchain: ${{ matrix.rust }}
         profile: minimal
         override: true
-    - uses: Swatinem/rust-cache@v2
+    - uses: Swatinem/rust-cache@v1
     - name: Build
       run: make build-${{matrix.features}}
     - name: Test
@@ -84,7 +84,7 @@ jobs:
         profile: minimal
         override: true
         components: rustfmt
-    - uses: Swatinem/rust-cache@v2
+    - uses: Swatinem/rust-cache@v1
     - name: Check formatting
       run: cargo fmt --all -- --check
   clippy:
@@ -106,7 +106,7 @@ jobs:
         profile: minimal
         override: true
         components: clippy
-    - uses: Swatinem/rust-cache@v2
+    - uses: Swatinem/rust-cache@v1
     - name: Lint (ultra-minimal)
       run: make clippy-minimal ARGS='--manifest-path Cargo.toml'
     - name: Lint Minimal
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9d2fb4c..fe8f6245 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,14 +13,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
 <!-- next-header -->
 ## [Unreleased] - ReleaseDate
 
-## [4.0.29] - 2022-11-29
-
-## [4.0.28] - 2022-11-29
-
-### Fixes
-
-- Fix wasm support which was broken in 4.0.27
-
 ## [4.0.27] - 2022-11-24
 
 ### Features
@@ -4041,9 +4033,7 @@ Minimum version of Rust is now v1.13.0 (Stable)
 * **arg**  allow lifetimes other than 'static in arguments ([9e8c1fb9](https://github.com/clap-rs/clap/commit/9e8c1fb9406f8448873ca58bab07fe905f1551e5))
 
 <!-- next-url -->
-[Unreleased]: https://github.com/clap-rs/clap/compare/v4.0.29...HEAD
-[4.0.29]: https://github.com/clap-rs/clap/compare/v4.0.28...v4.0.29
-[4.0.28]: https://github.com/clap-rs/clap/compare/v4.0.27...v4.0.28
+[Unreleased]: https://github.com/clap-rs/clap/compare/v4.0.27...HEAD
 [4.0.27]: https://github.com/clap-rs/clap/compare/v4.0.26...v4.0.27
 [4.0.26]: https://github.com/clap-rs/clap/compare/v4.0.25...v4.0.26
 [4.0.25]: https://github.com/clap-rs/clap/compare/v4.0.24...v4.0.25
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3787a067..0b852d38 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -71,29 +71,49 @@ As we work towards [a more flexible architecture](https://github.com/clap-rs/cla
 
 Note: We have not yet determined the End-of-Life schedule for previous major versions.  We will give at least a 2 month warning before changing the support status.
 
-### Verifying Changes
+### Testing Code
+
+To test with all features both enabled and disabled, you can run this command:
 
-A common (sub)set of commands for verifying your change:
 ```sh
-$ make test-full
-$ make clippy-full
-$ make doc
+$ cargo test --features "wrap_help yaml regex unstable-replace"
 ```
-*(If `make` is not available on your system, you can look up what these expand to in the [Makefile](./Makefile))*
 
-Check out the [Makefile](./Makefile) for more commands run by CI.
+Sometimes it's helpful to only run a subset of the tests, which can be done via:
+
+```sh
+$ cargo test --test <test_name>
+```
 
-### Debugging Clap
+### Linting Code
 
-A helpful technique is to see the `clap` debug output while developing features. In order to see the debug output while running the full test suite or individual tests, run:
+During the CI process `clap` runs against many different lints using [`clippy`](https://github.com/rust-lang/rust-clippy).
 
-```console
+In order to check the code for lints and to format it run:
+
+```sh
+$ cargo clippy --features "wrap_help yaml regex unstable-replace" -- -D warnings
+$ cargo fmt -- --check
+```
+
+### Debugging Code
+
+Another helpful technique is to see the `clap` debug output while developing features. In order to see the debug output while running the full test suite or individual tests, run:
+
+```sh
 $ cargo test --features debug
 
 # Or for individual tests
 $ cargo test --test <test_name> --features debug
 ```
 
+### Tests and Documentation
+
+1. Create tests for your changes
+2. **Ensure the tests are passing.** Run the tests as specified above.
+3. **Ensure linting is passing** Run the lints as specified above.
+4. Ensure your changes contain documentation if adding new APIs or features.
+
 ### Preparing the PR
 
 1. `git rebase` into concise commits and remove `--fixup`s or `wip` commits (`git rebase -i HEAD~NUM` where `NUM` is number of commits back to start the rebase)
@@ -101,7 +121,6 @@ $ cargo test --test <test_name> --features debug
 3. Create a pull request against `master`! (You can also create the pull request first, and we'll merge when ready. This a good way to discuss proposed changes.)
 
 PR expectations:
-- Changes are tested and, if needed, documented
 - PRs remain small and focused
  - If needed, we can put changes behind feature flags as they evolve
 - Commits are atomic (i.e. do a single thing)
diff --git a/Cargo.lock b/Cargo.lock
index 7575bccf..3095e02d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -132,7 +132,7 @@ dependencies = [
 
 [[package]]
 name = "clap"
-version = "4.0.29"
+version = "4.0.27"
 dependencies = [
  "backtrace",
  "bitflags",
@@ -159,7 +159,7 @@ dependencies = [
 name = "clap_bench"
 version = "0.0.0"
 dependencies = [
- "clap 4.0.29",
+ "clap 4.0.27",
  "criterion",
  "lazy_static",
 ]
@@ -168,7 +168,7 @@ dependencies = [
 name = "clap_complete"
 version = "4.0.6"
 dependencies = [
- "clap 4.0.29",
+ "clap 4.0.27",
  "clap_lex 0.3.0",
  "is_executable",
  "os_str_bytes",
@@ -183,7 +183,7 @@ dependencies = [
 name = "clap_complete_fig"
 version = "4.0.2"
 dependencies = [
- "clap 4.0.29",
+ "clap 4.0.27",
  "clap_complete",
  "snapbox",
 ]
@@ -219,7 +219,7 @@ dependencies = [
 name = "clap_mangen"
 version = "0.2.5"
 dependencies = [
- "clap 4.0.29",
+ "clap 4.0.27",
  "roff",
  "snapbox",
 ]
@@ -236,13 +236,13 @@ dependencies = [
 
 [[package]]
 name = "concolor"
-version = "0.0.11"
+version = "0.0.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "318d6c16e73b3a900eb212ad6a82fc7d298c5ab8184c7a9998646455bc474a16"
+checksum = "b90f9dcd9490a97db91a85ccd79e38a87e14323f0bb824659ee3274e9143ba37"
 dependencies = [
+ "atty",
  "bitflags",
  "concolor-query",
- "is-terminal",
 ]
 
 [[package]]
@@ -445,15 +445,15 @@ dependencies = [
 
 [[package]]
 name = "io-lifetimes"
-version = "0.7.5"
+version = "0.7.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074"
+checksum = "1ea37f355c05dde75b84bba2d767906ad522e97cd9e2eef2be7a4ab7fb442c06"
 
 [[package]]
 name = "io-lifetimes"
-version = "1.0.3"
+version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
+checksum = "a7d367024b3f3414d8e01f437f704f41a9f64ab36f9067fa73e526ad4c763c87"
 dependencies = [
  "libc",
  "windows-sys 0.42.0",
@@ -461,13 +461,13 @@ dependencies = [
 
 [[package]]
 name = "is-terminal"
-version = "0.4.1"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
+checksum = "aae5bc6e2eb41c9def29a3e0f1306382807764b9b53112030eff57435667352d"
 dependencies = [
  "hermit-abi 0.2.6",
- "io-lifetimes 1.0.3",
- "rustix 0.36.4",
+ "io-lifetimes 1.0.1",
+ "rustix 0.36.3",
  "windows-sys 0.42.0",
 ]
 
@@ -752,27 +752,27 @@ checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
 
 [[package]]
 name = "rustix"
-version = "0.35.13"
+version = "0.35.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9"
+checksum = "72c825b8aa8010eb9ee99b75f05e10180b9278d161583034d7574c9d617aeada"
 dependencies = [
  "bitflags",
  "errno",
- "io-lifetimes 0.7.5",
+ "io-lifetimes 0.7.3",
  "libc",
  "linux-raw-sys 0.0.46",
- "windows-sys 0.42.0",
+ "windows-sys 0.36.1",
 ]
 
 [[package]]
 name = "rustix"
-version = "0.36.4"
+version = "0.36.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23"
+checksum = "0b1fbb4dfc4eb1d390c02df47760bb19a84bb80b301ecc947ab5406394d8223e"
 dependencies = [
  "bitflags",
  "errno",
- "io-lifetimes 1.0.3",
+ "io-lifetimes 1.0.1",
  "libc",
  "linux-raw-sys 0.1.3",
  "windows-sys 0.42.0",
@@ -850,9 +850,9 @@ checksum = "62ac7f900db32bf3fd12e0117dd3dc4da74bc52ebaac97f39668446d89694803"
 
 [[package]]
 name = "snapbox"
-version = "0.4.3"
+version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "efbd7b250c7243273b5aec4ca366fced84ad716d110bb7baae4814678952ebde"
+checksum = "827c00e91b15e2674d8a5270bae91f898693cbf9561cbb58d8eaa31974597293"
 dependencies = [
  "concolor",
  "libc",
@@ -861,7 +861,7 @@ dependencies = [
  "similar",
  "snapbox-macros",
  "wait-timeout",
- "windows-sys 0.42.0",
+ "winapi",
  "yansi",
 ]
 
@@ -909,7 +909,7 @@ version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8440c860cf79def6164e4a0a983bcc2305d82419177a0e0c71930d049e3ac5a1"
 dependencies = [
- "rustix 0.35.13",
+ "rustix 0.35.9",
  "windows-sys 0.36.1",
 ]
 
@@ -962,9 +962,9 @@ dependencies = [
 
 [[package]]
 name = "trybuild"
-version = "1.0.72"
+version = "1.0.71"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db29f438342820400f2d9acfec0d363e987a38b2950bdb50a7069ed17b2148ee"
+checksum = "ea496675d71016e9bc76aa42d87f16aefd95447cc5818e671e12b2d7e269075d"
 dependencies = [
  "glob",
  "once_cell",
@@ -977,9 +977,9 @@ dependencies = [
 
 [[package]]
 name = "trycmd"
-version = "0.14.5"
+version = "0.14.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e381af441e13a3635303d26769620a9454aef05ec3303711efc3f1dd785a33af"
+checksum = "3b3e659433fd96381bbbd80a5d2a664e930444e222ea28e434fd4f6810525101"
 dependencies = [
  "escargot",
  "glob",
diff --git a/Cargo.toml b/Cargo.toml
index f0c4c5a0..f025dde4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,7 +10,7 @@ members = [
 
 [package]
 name = "clap"
-version = "4.0.29"
+version = "4.0.27"
 description = "A simple to use, efficient, and full-featured Command Line Argument Parser"
 repository = "https://github.com/clap-rs/clap"
 categories = ["command-line-interface"]
@@ -37,7 +37,7 @@ include = [
 [package.metadata.docs.rs]
 features = ["unstable-doc"]
 rustdoc-args = ["--cfg", "docsrs"]
-cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
+cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples=examples"]
 
 [package.metadata.playground]
 features = ["unstable-doc"]
@@ -96,7 +96,7 @@ clap_lex = { path = "./clap_lex", version = "0.3.0" }
 bitflags = "1.2"
 unicase = { version = "2.6", optional = true }
 strsim = { version = "0.10",  optional = true }
-is-terminal = { version = "0.4.1",  optional = true }
+is-terminal = { version = "0.4",  optional = true }
 termcolor = { version = "1.1.1", optional = true }
 terminal_size = { version = "0.2.1", optional = true }
 backtrace = { version = "0.3", optional = true }
@@ -104,10 +104,10 @@ unicode-width = { version = "0.1.9", optional = true }
 once_cell = { version = "1.12.0", optional = true }
 
 [dev-dependencies]
-trybuild = "1.0.72"
+trybuild = "1.0.71"
 rustversion = "1"
 # Cutting out `filesystem` feature
-trycmd = { version = "0.14.5", default-features = false, features = ["color-auto", "diff", "examples"] }
+trycmd = { version = "0.14.3", default-features = false, features = ["color-auto", "diff", "examples"] }
 humantime = "2"
 snapbox = "0.4"
 shlex = "1.1.0"
diff --git a/clap_complete/Cargo.toml b/clap_complete/Cargo.toml
index abbd074e..ca9263d2 100644
--- a/clap_complete/Cargo.toml
+++ b/clap_complete/Cargo.toml
@@ -51,7 +51,7 @@ unicode-xid = { version = "0.2.2", optional = true }
 [dev-dependencies]
 snapbox = { version = "0.4", features = ["diff"] }
 # Cutting out `filesystem` feature
-trycmd = { version = "0.14.5", default-features = false, features = ["color-auto", "diff", "examples"] }
+trycmd = { version = "0.14.3", default-features = false, features = ["color-auto", "diff", "examples"] }
 clap = { path = "../", version = "4.0.0", default-features = false, features = ["std", "derive", "help"] }
 
 [[example]]
diff --git a/committed.toml b/committed.toml
index 4211ae38..08815cf9 100644
--- a/committed.toml
+++ b/committed.toml
@@ -1,3 +1,3 @@
 style="conventional"
-ignore_author_re="(dependabot|renovate)"
+ignore_author_re="dependabot"
 merge_commit = false
diff --git a/src/_derive/mod.rs b/src/_derive/mod.rs
index b09cdf6b..f5da2363 100644
--- a/src/_derive/mod.rs
+++ b/src/_derive/mod.rs
@@ -177,18 +177,6 @@
 //! - `external_subcommand`: [`Command::allow_external_subcommand(true)`][crate::Command::allow_external_subcommands]
 //!   - Variant must be either `Variant(Vec<String>)` or `Variant(Vec<OsString>)`
 //!
-//! And for [`Args`][crate::Args] fields:
-//! - `flatten`: Delegates to the field for more arguments (must implement [`Args`][crate::Args])
-//!   - Only [`next_help_heading`][crate::Command::next_help_heading] can be used with `flatten`.  See
-//!     [clap-rs/clap#3269](https://github.com/clap-rs/clap/issues/3269) for why
-//!     arg attributes are not generally supported.
-//!   - **Tip:** Though we do apply a flattened [`Args`][crate::Args]'s Parent Command Attributes, this
-//!     makes reuse harder. Generally prefer putting the cmd attributes on the
-//!     [`Parser`][crate::Parser] or on the flattened field.
-//! - `subcommand`: Delegates definition of subcommands to the field (must implement
-//!   [`Subcommand`][crate::Subcommand])
-//!   - When `Option<T>`, the subcommand becomes optional
-//!
 //! ### ArgGroup Attributes
 //!
 //! These correspond to the [`ArgGroup`][crate::ArgGroup] which is implicitly created for each
@@ -226,6 +214,16 @@
 //! - `env [= <str>]`: [`Arg::env`][crate::Arg::env] (needs [`env` feature][crate::_features] enabled)
 //!   - When not present: no env set
 //!   - Without `<str>`: defaults to the case-converted field name
+//! - `flatten`: Delegates to the field for more arguments (must implement [`Args`][crate::Args])
+//!   - Only [`next_help_heading`][crate::Command::next_help_heading] can be used with `flatten`.  See
+//!     [clap-rs/clap#3269](https://github.com/clap-rs/clap/issues/3269) for why
+//!     arg attributes are not generally supported.
+//!   - **Tip:** Though we do apply a flattened [`Args`][crate::Args]'s Parent Command Attributes, this
+//!     makes reuse harder. Generally prefer putting the cmd attributes on the
+//!     [`Parser`][crate::Parser] or on the flattened field.
+//! - `subcommand`: Delegates definition of subcommands to the field (must implement
+//!   [`Subcommand`][crate::Subcommand])
+//!   - When `Option<T>`, the subcommand becomes optional
 //! - `from_global`: Read a [`Arg::global`][crate::Arg::global] argument (raw attribute), regardless of what subcommand you are in
 //! - `value_enum`: Parse the value using the [`ValueEnum`][crate::ValueEnum]
 //! - `skip [= <expr>]`: Ignore this field, filling in with `<expr>`
diff --git a/src/_tutorial.rs b/src/_tutorial.rs
index 4605ec9a..3f0a8333 100644
--- a/src/_tutorial.rs
+++ b/src/_tutorial.rs
@@ -75,7 +75,7 @@
 //! ```
 #![doc = include_str!("../examples/tutorial_builder/03_03_positional.md")]
 //!
-//! Note that the default [`ArgAction`][crate::ArgAction] is [`Set`][crate::ArgAction::Set].  To
+//! Note that the default [`ArgAction`][crate::ArgAction]` is [`Set`][crate::ArgAction::Set].  To
 //! accept multiple values, use [`Append`][crate::ArgAction::Append]:
 //! ```rust
 #![doc = include_str!("../examples/tutorial_builder/03_03_positional_mult.rs")]
@@ -94,7 +94,7 @@
 //! ```
 #![doc = include_str!("../examples/tutorial_builder/03_02_option.md")]
 //!
-//! Note that the default [`ArgAction`][crate::ArgAction] is [`Set`][crate::ArgAction::Set].  To
+//! Note that the default [`ArgAction`][crate::ArgAction]` is [`Set`][crate::ArgAction::Set].  To
 //! accept multiple occurrences, use [`Append`][crate::ArgAction::Append]:
 //! ```rust
 #![doc = include_str!("../examples/tutorial_builder/03_02_option_mult.rs")]
diff --git a/src/builder/resettable.rs b/src/builder/resettable.rs
index e0b82b11..0176d398 100644
--- a/src/builder/resettable.rs
+++ b/src/builder/resettable.rs
@@ -10,24 +10,6 @@ use crate::builder::ValueParser;
 use crate::builder::ValueRange;
 
 /// Clearable builder value
-///
-/// This allows a builder function to both accept any value that can [`Into::into`] `T` (like
-/// `&str` into `OsStr`) as well as `None` to reset it to the default.  This is needed to
-/// workaround a limitation where you can't have a function argument that is `impl Into<Option<T>>`
-/// where `T` is `impl Into<S>` accept `None` as its type is ambiguous.
-///
-/// # Example
-///
-/// ```rust
-/// # use clap::Command;
-/// # use clap::Arg;
-/// fn common() -> Command {
-///     Command::new("cli")
-///         .arg(Arg::new("input").short('i').long("input"))
-/// }
-/// let mut command = common();
-/// command.mut_arg("input", |arg| arg.short(None));
-/// ```
 #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
 pub enum Resettable<T> {
     /// Overwrite builder value
diff --git a/src/builder/styled_str.rs b/src/builder/styled_str.rs
index d36329de..ecd05a35 100644
--- a/src/builder/styled_str.rs
+++ b/src/builder/styled_str.rs
@@ -1,7 +1,4 @@
 /// Terminal-styling container
-///
-/// For now, this is the same as a [`Str`][crate::builder::Str].  This exists to reserve space in
-/// the API for exposing terminal styling.
 #[derive(Clone, Default, Debug, PartialEq, Eq)]
 pub struct StyledStr {
     #[cfg(feature = "color")]
diff --git a/src/macros.rs b/src/macros.rs
index 0e609eef..a512d890 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -85,6 +85,12 @@ macro_rules! crate_description {
 
 /// Allows you to pull the name from your Cargo.toml at compile time.
 ///
+/// **NOTE:** This macro extracts the name from an environment variable `CARGO_PKG_NAME`.
+/// When the crate name is set to something different from the package name,
+/// use environment variables `CARGO_CRATE_NAME` or `CARGO_BIN_NAME`.
+/// See [the Cargo Book](https://doc.rust-lang.org/cargo/reference/environment-variables.html)
+/// for more information.
+///
 /// # Examples
 ///
 /// ```no_run


Test patch:
diff --git a/tests/builder/default_vals.rs b/tests/builder/default_vals.rs
index d362134b..f9831807 100644
--- a/tests/builder/default_vals.rs
+++ b/tests/builder/default_vals.rs
@@ -17,10 +17,6 @@ fn opts() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(m.contains_id("o"));
-    assert_eq!(
-        m.value_source("o").unwrap(),
-        clap::parser::ValueSource::DefaultValue
-    );
     assert_eq!(
         m.get_one::<String>("o").map(|v| v.as_str()).unwrap(),
         "default"
@@ -63,10 +59,6 @@ fn opt_user_override() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(m.contains_id("opt"));
-    assert_eq!(
-        m.value_source("opt").unwrap(),
-        clap::parser::ValueSource::CommandLine
-    );
     assert_eq!(
         m.get_one::<String>("opt").map(|v| v.as_str()).unwrap(),
         "value"
@@ -81,10 +73,6 @@ fn positionals() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(m.contains_id("arg"));
-    assert_eq!(
-        m.value_source("arg").unwrap(),
-        clap::parser::ValueSource::DefaultValue
-    );
     assert_eq!(
         m.get_one::<String>("arg").map(|v| v.as_str()).unwrap(),
         "default"
@@ -99,10 +87,6 @@ fn positional_user_override() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(m.contains_id("arg"));
-    assert_eq!(
-        m.value_source("arg").unwrap(),
-        clap::parser::ValueSource::CommandLine
-    );
     assert_eq!(
         m.get_one::<String>("arg").map(|v| v.as_str()).unwrap(),
         "value"
diff --git a/tests/builder/env.rs b/tests/builder/env.rs
index 11ea87f5..e3f5ad9b 100644
--- a/tests/builder/env.rs
+++ b/tests/builder/env.rs
@@ -20,10 +20,6 @@ fn env() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(m.contains_id("arg"));
-    assert_eq!(
-        m.value_source("arg").unwrap(),
-        clap::parser::ValueSource::EnvVariable
-    );
     assert_eq!(
         m.get_one::<String>("arg").map(|v| v.as_str()).unwrap(),
         "env"
@@ -104,7 +100,6 @@ fn no_env() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(!m.contains_id("arg"));
-    assert_eq!(m.value_source("arg"), None);
     assert_eq!(m.get_one::<String>("arg").map(|v| v.as_str()), None);
 }
 
@@ -121,7 +116,6 @@ fn no_env_no_takes_value() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(!m.contains_id("arg"));
-    assert_eq!(m.value_source("arg"), None);
     assert_eq!(m.get_one::<String>("arg").map(|v| v.as_str()), None);
 }
 
@@ -141,10 +135,6 @@ fn with_default() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(m.contains_id("arg"));
-    assert_eq!(
-        m.value_source("arg").unwrap(),
-        clap::parser::ValueSource::EnvVariable
-    );
     assert_eq!(
         m.get_one::<String>("arg").map(|v| v.as_str()).unwrap(),
         "env"
@@ -166,10 +156,6 @@ fn opt_user_override() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(m.contains_id("arg"));
-    assert_eq!(
-        m.value_source("arg").unwrap(),
-        clap::parser::ValueSource::CommandLine
-    );
     assert_eq!(
         m.get_one::<String>("arg").map(|v| v.as_str()).unwrap(),
         "opt"
@@ -199,10 +185,6 @@ fn positionals() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(m.contains_id("arg"));
-    assert_eq!(
-        m.value_source("arg").unwrap(),
-        clap::parser::ValueSource::EnvVariable
-    );
     assert_eq!(
         m.get_one::<String>("arg").map(|v| v.as_str()).unwrap(),
         "env"
@@ -224,10 +206,6 @@ fn positionals_user_override() {
     assert!(r.is_ok(), "{}", r.unwrap_err());
     let m = r.unwrap();
     assert!(m.contains_id("arg"));
-    assert_eq!(
-        m.value_source("arg").unwrap(),
-        clap::parser::ValueSource::CommandLine
-    );
     assert_eq!(
         m.get_one::<String>("arg").map(|v| v.as_str()).unwrap(),
         "opt"