Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make lifetimes descriptive #2025

Merged
merged 1 commit into from
Jul 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, their visible aliases 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_and_visible_aliases<'b>(p: &'b App<'b>) -> Vec<char> {
fn shorts_and_visible_aliases<'help>(p: &App<'help>) -> Vec<char> {
debug!("shorts: name={}", p.get_name());

let mut shorts_and_visible_aliases: Vec<char> = p
Expand Down Expand Up @@ -159,7 +162,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 @@ -188,7 +191,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