From ac42f6cf0de6c4920f703807d63061803930b18d Mon Sep 17 00:00:00 2001 From: Hendrik Sollich Date: Wed, 11 May 2016 21:08:25 +0200 Subject: [PATCH] Fix: SubCommand::aliases lifetime errors --- src/app/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index 16ee5ff7c09..69ade73a4f5 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -543,17 +543,17 @@ impl<'a, 'b> App<'a, 'b> { /// .arg(Arg::with_name("input") /// .help("the file to add") /// .index(1) - /// .required(true)) + /// .required(false)) /// .get_matches_from(vec!["myprog", "do-tests"]); /// assert_eq!(m.subcommand_name(), Some("test")); /// ``` - pub fn aliases + 'b>(mut self, names: &'b [S]) -> Self { + pub fn aliases(mut self, names: &[&'b str]) -> Self { if let Some(ref mut als) = self.p.meta.aliases { for n in names { - als.push(n.as_ref()); + als.push(n); } } else { - self.p.meta.aliases = Some(names.iter().map(|n| n.as_ref()).collect()); + self.p.meta.aliases = Some(names.iter().map(|n| *n).collect::>()); } self }