From dd499ab1111e048c8e1a3c89d02efc7f3911fc12 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 14 Dec 2021 09:44:36 -0600 Subject: [PATCH] feat!: Allow resetting abouts/help to default I dislike the inconsistency with only a few fields providing this (this and `help_heading`) but this is to address a specific bug. We need to visit this, along with iterators (#2870) and string handling (#2150). `Arg` came along for the ride because the derive logic is applied to both. `PossibleValue` didn't need it because we filter out `long_help`. BREAKING CHANGE: We changed the signatures for `App::about`, `App::long_about`, `Arg::help`, and `Arg::long_help` from accepting anything `Into<&str>` to `&str`. --- src/build/app/mod.rs | 8 ++++---- src/build/arg/mod.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/build/app/mod.rs b/src/build/app/mod.rs index 32dc75a37a72..22136f7a4c46 100644 --- a/src/build/app/mod.rs +++ b/src/build/app/mod.rs @@ -896,8 +896,8 @@ impl<'help> App<'help> { /// .about("Does really amazing things for great people") /// # ; /// ``` - pub fn about>(mut self, about: S) -> Self { - self.about = Some(about.into()); + pub fn about>>(mut self, about: O) -> Self { + self.about = about.into(); self } @@ -920,8 +920,8 @@ impl<'help> App<'help> { /// # ; /// ``` /// [`App::about`]: App::about() - pub fn long_about>(mut self, about: S) -> Self { - self.long_about = Some(about.into()); + pub fn long_about>>(mut self, long_about: O) -> Self { + self.long_about = long_about.into(); self } diff --git a/src/build/arg/mod.rs b/src/build/arg/mod.rs index 539ec685b048..ff9d05ed7aed 100644 --- a/src/build/arg/mod.rs +++ b/src/build/arg/mod.rs @@ -2712,8 +2712,8 @@ impl<'help> Arg<'help> { /// ``` /// [`Arg::long_help`]: Arg::long_help() #[inline] - pub fn help(mut self, h: &'help str) -> Self { - self.help = Some(h); + pub fn help(mut self, h: impl Into>) -> Self { + self.help = h.into(); self } @@ -2773,8 +2773,8 @@ impl<'help> Arg<'help> { /// ``` /// [`Arg::help`]: Arg::help() #[inline] - pub fn long_help(mut self, h: &'help str) -> Self { - self.long_help = Some(h); + pub fn long_help(mut self, h: impl Into>) -> Self { + self.long_help = h.into(); self }