Skip to content

Commit

Permalink
Merge #2025
Browse files Browse the repository at this point in the history
2025: Make lifetimes descriptive r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
  • Loading branch information
bors[bot] and CreepySkeleton authored Jul 20, 2020
2 parents dc363d0 + 3de53f2 commit 9993e29
Show file tree
Hide file tree
Showing 17 changed files with 217 additions and 228 deletions.
11 changes: 7 additions & 4 deletions clap_generate/src/generators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ pub trait Generator {
/// **NOTE:** `path` should not contain the root `bin_name`.
///
/// [clap]: ../clap/struct.App.html
fn find_subcommand_with_path<'b>(p: &'b App<'b>, path: Vec<&str>) -> &'b App<'b> {
fn find_subcommand_with_path<'help, 'app>(
p: &'app App<'help>,
path: Vec<&str>,
) -> &'app App<'help> {
let mut app = p;

for sc in path {
Expand Down Expand Up @@ -114,7 +117,7 @@ pub trait Generator {

/// Gets all the short options and flags of a [`clap::App`](../clap/struct.App.html).
/// Includes `h` and `V` depending on the [`clap::AppSettings`](../clap/enum.AppSettings.html).
fn shorts<'b>(p: &'b App<'b>) -> Vec<char> {
fn shorts<'help>(p: &App<'help>) -> Vec<char> {
debug!("shorts: name={}", p.get_name());

let mut shorts: Vec<char> = p
Expand All @@ -141,7 +144,7 @@ pub trait Generator {

/// Gets all the long options and flags of a [`clap::App`](../clap/struct.App.html).
/// Includes `help` and `version` depending on the [`clap::AppSettings`](../clap/enum.AppSettings.html).
fn longs<'b>(p: &'b App<'b>) -> Vec<String> {
fn longs<'help>(p: &App<'help>) -> Vec<String> {
debug!("longs: name={}", p.get_name());

let mut longs: Vec<String> = p
Expand Down Expand Up @@ -170,7 +173,7 @@ pub trait Generator {

/// Gets all the flags of a [`clap::App`](../clap/struct.App.html).
/// Includes `help` and `version` depending on the [`clap::AppSettings`](../clap/enum.AppSettings.html).
fn flags<'b>(p: &'b App<'b>) -> Vec<Arg> {
fn flags<'help>(p: &App<'help>) -> Vec<Arg<'help>> {
debug!("flags: name={}", p.get_name());

let mut flags: Vec<_> = p.get_flags_no_heading().cloned().collect();
Expand Down
6 changes: 3 additions & 3 deletions clap_generate/src/generators/shells/elvish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ fn get_tooltip<T: ToString>(help: Option<&str>, data: T) -> String {
}
}

fn generate_inner<'b>(
p: &'b App<'b>,
fn generate_inner<'help>(
p: &App<'help>,
previous_command_name: &str,
names: &mut Vec<&'b str>,
names: &mut Vec<&'help str>,
) -> String {
debug!("generate_inner");

Expand Down
6 changes: 3 additions & 3 deletions clap_generate/src/generators/shells/powershell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ fn get_tooltip<T: ToString>(help: Option<&str>, data: T) -> String {
}
}

fn generate_inner<'b>(
p: &'b App<'b>,
fn generate_inner<'help>(
p: &App<'help>,
previous_command_name: &str,
names: &mut Vec<&'b str>,
names: &mut Vec<&'help str>,
) -> String {
debug!("generate_inner");

Expand Down
2 changes: 1 addition & 1 deletion clap_generate/src/generators/shells/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ esac",
)
}

fn parser_of<'b>(p: &'b App<'b>, mut sc: &str) -> &'b App<'b> {
fn parser_of<'help, 'app>(p: &'app App<'help>, mut sc: &str) -> &'app App<'help> {
debug!("parser_of: sc={}", sc);

if sc == p.get_bin_name().unwrap_or(&String::new()) {
Expand Down
Loading

0 comments on commit 9993e29

Please sign in to comment.