From 862a0ffe9bea10ab61a9d140b3170e902f6ac008 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 7 Aug 2024 10:29:42 -0500 Subject: [PATCH 1/3] docs: Include unstable-ext --- clap_builder/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clap_builder/Cargo.toml b/clap_builder/Cargo.toml index 5ae18d9ca37..827c31bc91d 100644 --- a/clap_builder/Cargo.toml +++ b/clap_builder/Cargo.toml @@ -32,7 +32,7 @@ tag-name = "v{{version}}" [features] default = ["std", "color", "help", "usage", "error-context", "suggestions"] debug = ["dep:backtrace"] # Enables debug messages -unstable-doc = ["cargo", "wrap_help", "env", "unicode", "string"] # for docs.rs +unstable-doc = ["cargo", "wrap_help", "env", "unicode", "string", "unstable-ext"] # for docs.rs # Used in default std = ["anstyle/std"] # support for no_std in a backwards-compatible way From c6d7a329355e72a8d7aeeda010f56b1b6e6e036b Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 7 Aug 2024 10:30:00 -0500 Subject: [PATCH 2/3] test: Include unstable-ext --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fd86e797c0e..0fac242ea85 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ _FEATURES = minimal default wasm full debug release _FEATURES_minimal = --no-default-features --features "std" _FEATURES_default = _FEATURES_wasm = --no-default-features --features "std help usage error-context suggestions" --features "deprecated derive cargo env unicode string" -_FEATURES_full = --features "deprecated derive cargo env unicode string wrap_help" +_FEATURES_full = --features "deprecated derive cargo env unicode string wrap_help unstable-ext" _FEATURES_next = ${_FEATURES_full} --features unstable-v5 _FEATURES_debug = ${_FEATURES_full} --features debug --features clap_complete/debug _FEATURES_release = ${_FEATURES_full} --release From 11538586eb0ca460b193eaaf99b86fdac740aba8 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 7 Aug 2024 10:40:07 -0500 Subject: [PATCH 3/3] fix(ext)!: Make extension methods fluent --- clap_builder/src/builder/arg.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/clap_builder/src/builder/arg.rs b/clap_builder/src/builder/arg.rs index 6768d17d814..0ba84ae321c 100644 --- a/clap_builder/src/builder/arg.rs +++ b/clap_builder/src/builder/arg.rs @@ -875,14 +875,17 @@ impl Arg { /// Extend [`Arg`] with [`ArgExt`] data #[cfg(feature = "unstable-ext")] - pub fn add(&mut self, tagged: T) -> bool { - self.ext.set(tagged) + #[allow(clippy::should_implement_trait)] + pub fn add(mut self, tagged: T) -> Self { + self.ext.set(tagged); + self } /// Remove an [`ArgExt`] #[cfg(feature = "unstable-ext")] - pub fn remove(&mut self) -> Option { - self.ext.remove::() + pub fn remove(mut self) -> Self { + self.ext.remove::(); + self } }