From b0f4335bf71eca741df49a5e5db1b53750d8f0f9 Mon Sep 17 00:00:00 2001 From: "Shawn T. Amundson" Date: Fri, 26 Jan 2024 16:27:38 -0600 Subject: [PATCH] Fix "needless_lifetimes" lint error Signed-off-by: Shawn T. Amundson --- cli/src/action/certs.rs | 2 +- cli/src/action/circuit/mod.rs | 18 +++++++++--------- cli/src/action/circuit/template.rs | 6 +++--- cli/src/action/database/mod.rs | 2 +- cli/src/action/database/state/mod.rs | 2 +- cli/src/action/database/upgrade/mod.rs | 2 +- cli/src/action/health.rs | 2 +- cli/src/action/keygen.rs | 2 +- cli/src/action/maintenance.rs | 6 +++--- cli/src/action/mod.rs | 4 ++-- cli/src/action/permissions.rs | 2 +- cli/src/action/rbac/assignments.rs | 14 +++++++------- cli/src/action/rbac/roles.rs | 12 ++++++------ cli/src/action/registry/mod.rs | 4 ++-- cli/src/action/user/mod.rs | 2 +- 15 files changed, 40 insertions(+), 40 deletions(-) diff --git a/cli/src/action/certs.rs b/cli/src/action/certs.rs index 42f0865d8..a718f2408 100644 --- a/cli/src/action/certs.rs +++ b/cli/src/action/certs.rs @@ -58,7 +58,7 @@ const REST_API_CERT: &str = "rest_api.crt"; const REST_API_KEY: &str = "rest_api.key"; impl Action for CertGenAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; #[cfg(not(feature = "https-certs"))] diff --git a/cli/src/action/circuit/mod.rs b/cli/src/action/circuit/mod.rs index e9bfb4fef..fa3a49446 100644 --- a/cli/src/action/circuit/mod.rs +++ b/cli/src/action/circuit/mod.rs @@ -50,7 +50,7 @@ use payload::make_signed_payload; pub struct CircuitProposeAction; impl Action for CircuitProposeAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let mut builder = CreateCircuitMessageBuilder::new(); @@ -662,7 +662,7 @@ struct CircuitVote { pub struct CircuitVoteAction; impl Action for CircuitVoteAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let url = args .value_of("url") @@ -726,7 +726,7 @@ struct CircuitDisband { pub struct CircuitDisbandAction; impl Action for CircuitDisbandAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let url = args .value_of("url") @@ -778,7 +778,7 @@ struct CircuitPurge { pub struct CircuitPurgeAction; impl Action for CircuitPurgeAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let url = args .value_of("url") @@ -839,7 +839,7 @@ struct AbandonedCircuit { pub struct CircuitAbandonAction; impl Action for CircuitAbandonAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let url = args .value_of("url") @@ -900,7 +900,7 @@ struct RemoveProposal { pub struct RemoveProposalAction; impl Action for RemoveProposalAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let url = args .value_of("url") @@ -948,7 +948,7 @@ fn request_proposal_removal( pub struct CircuitListAction; impl Action for CircuitListAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let url = arg_matches .and_then(|args| args.value_of("url")) .map(ToOwned::to_owned) @@ -1034,7 +1034,7 @@ fn list_circuits( pub struct CircuitShowAction; impl Action for CircuitShowAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let url = args @@ -1129,7 +1129,7 @@ fn show_circuit( pub struct CircuitProposalsAction; impl Action for CircuitProposalsAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let url = arg_matches .and_then(|args| args.value_of("url")) .map(ToOwned::to_owned) diff --git a/cli/src/action/circuit/template.rs b/cli/src/action/circuit/template.rs index 9176d51a2..8d165be01 100644 --- a/cli/src/action/circuit/template.rs +++ b/cli/src/action/circuit/template.rs @@ -22,7 +22,7 @@ use super::Action; pub struct ListCircuitTemplates; impl Action for ListCircuitTemplates { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { // Collect list of template file stems and full paths to the associated file stem let templates = CircuitTemplate::list_available_templates()?; @@ -75,7 +75,7 @@ impl Action for ListCircuitTemplates { pub struct ShowCircuitTemplate; impl Action for ShowCircuitTemplate { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let template_name = match args.value_of("name") { Some(name) => name, @@ -93,7 +93,7 @@ impl Action for ShowCircuitTemplate { pub struct ListCircuitTemplateArguments; impl Action for ListCircuitTemplateArguments { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let template_name = match args.value_of("name") { Some(name) => name, diff --git a/cli/src/action/database/mod.rs b/cli/src/action/database/mod.rs index 7ca7f7806..465cb020e 100644 --- a/cli/src/action/database/mod.rs +++ b/cli/src/action/database/mod.rs @@ -46,7 +46,7 @@ const DEFAULT_STATE_DIR: &str = "/var/lib/splinter"; pub struct MigrateAction; impl Action for MigrateAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let url = if let Some(args) = arg_matches { match args.value_of("connect") { Some(url) => url.to_owned(), diff --git a/cli/src/action/database/state/mod.rs b/cli/src/action/database/state/mod.rs index 88491bc9b..24cd99be4 100644 --- a/cli/src/action/database/state/mod.rs +++ b/cli/src/action/database/state/mod.rs @@ -45,7 +45,7 @@ pub trait StateTreeStore { pub struct StateMigrateAction; impl Action for StateMigrateAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let state_dir = get_state_dir(arg_matches).map_err(|e| CliError::ActionError(format!("{}", e)))?; let lmdb_db_factory = LmdbDatabaseFactory::new_state_db_factory(&state_dir, None); diff --git a/cli/src/action/database/upgrade/mod.rs b/cli/src/action/database/upgrade/mod.rs index 68e0ea9d5..4acda07e8 100644 --- a/cli/src/action/database/upgrade/mod.rs +++ b/cli/src/action/database/upgrade/mod.rs @@ -42,7 +42,7 @@ use super::Action; pub struct UpgradeAction; impl Action for UpgradeAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let state_dir = get_state_dir(arg_matches)?; let database_uri = get_database_uri(arg_matches)?; let store_factory = create_store_factory(database_uri).map_err(|err| { diff --git a/cli/src/action/health.rs b/cli/src/action/health.rs index 260d1b637..89e7d1c4b 100644 --- a/cli/src/action/health.rs +++ b/cli/src/action/health.rs @@ -28,7 +28,7 @@ const SPLINTERD_MISSING_HEALTH_STATUS: &str = "The health status endpoint was no feature."; impl Action for StatusAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let url = arg_matches .and_then(|args| args.value_of("url")) .map(ToOwned::to_owned) diff --git a/cli/src/action/keygen.rs b/cli/src/action/keygen.rs index ca8902e48..cdc60150a 100644 --- a/cli/src/action/keygen.rs +++ b/cli/src/action/keygen.rs @@ -81,7 +81,7 @@ impl GroupOptions { } impl Action for KeyGenAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let group: Option = args .value_of("group") diff --git a/cli/src/action/maintenance.rs b/cli/src/action/maintenance.rs index 3e7697521..330c25729 100644 --- a/cli/src/action/maintenance.rs +++ b/cli/src/action/maintenance.rs @@ -26,7 +26,7 @@ use super::{ pub struct StatusAction; impl Action for StatusAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let status = if new_client(arg_matches)?.is_maintenance_mode_enabled()? { "enabled" } else { @@ -40,7 +40,7 @@ impl Action for StatusAction { pub struct EnableAction; impl Action for EnableAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { new_client(arg_matches)?.set_maintenance_mode(true)?; println!("Maintenance mode has been enabled"); Ok(()) @@ -50,7 +50,7 @@ impl Action for EnableAction { pub struct DisableAction; impl Action for DisableAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { new_client(arg_matches)?.set_maintenance_mode(false)?; println!("Maintenance mode has been disabled"); Ok(()) diff --git a/cli/src/action/mod.rs b/cli/src/action/mod.rs index 8351254e2..64760ddd6 100644 --- a/cli/src/action/mod.rs +++ b/cli/src/action/mod.rs @@ -47,7 +47,7 @@ const SPLINTER_REST_API_URL_ENV: &str = "SPLINTER_REST_API_URL"; /// An Action is a single subcommand for CLI operations. pub trait Action { /// Run a CLI Action with the given args - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError>; + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError>; } /// A collection of Subcommands associated with a single parent command. @@ -73,7 +73,7 @@ impl<'a> SubcommandActions<'a> { } impl<'s> Action for SubcommandActions<'s> { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let (subcommand, args) = args.subcommand(); diff --git a/cli/src/action/permissions.rs b/cli/src/action/permissions.rs index e4bd9b3f1..06a22345e 100644 --- a/cli/src/action/permissions.rs +++ b/cli/src/action/permissions.rs @@ -35,7 +35,7 @@ use super::{ pub struct ListAction; impl Action for ListAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let format = arg_matches .and_then(|args| args.value_of("format")) .unwrap_or("human"); diff --git a/cli/src/action/rbac/assignments.rs b/cli/src/action/rbac/assignments.rs index 0e2a96850..42e77b048 100644 --- a/cli/src/action/rbac/assignments.rs +++ b/cli/src/action/rbac/assignments.rs @@ -34,7 +34,7 @@ use super::new_client; pub struct ListAssignmentsAction; impl Action for ListAssignmentsAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let format = arg_matches .and_then(|args| args.value_of("format")) .unwrap_or("human"); @@ -85,7 +85,7 @@ impl Action for ListAssignmentsAction { pub struct CreateAssignmentAction; impl Action for CreateAssignmentAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let identity = get_identity_arg(&arg_matches)?; let roles = arg_matches @@ -123,7 +123,7 @@ impl Action for CreateAssignmentAction { pub struct ShowAssignmentAction; impl Action for ShowAssignmentAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let format = arg_matches .and_then(|args| args.value_of("format")) .unwrap_or("human"); @@ -174,7 +174,7 @@ impl Action for ShowAssignmentAction { pub struct UpdateAssignmentAction; impl Action for UpdateAssignmentAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let identity = get_identity_arg(&arg_matches)?; let force = arg_matches @@ -301,7 +301,7 @@ fn update_assignment( pub struct DeleteAssignmentAction; impl Action for DeleteAssignmentAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let identity = get_identity_arg(&arg_matches)?; if !is_dry_run(&arg_matches) { new_client(&arg_matches)?.delete_assignment(&identity) @@ -321,7 +321,7 @@ fn display_human_readable(assignment: &Assignment) { } } -fn get_identity_arg<'a>(arg_matches: &Option<&ArgMatches<'a>>) -> Result { +fn get_identity_arg(arg_matches: &Option<&ArgMatches>) -> Result { if let Some(key) = arg_matches .and_then(|args| args.value_of("id_key")) .map(|s| s.to_string()) @@ -341,7 +341,7 @@ fn get_identity_arg<'a>(arg_matches: &Option<&ArgMatches<'a>>) -> Result(arg_matches: &Option<&ArgMatches<'a>>) -> bool { +fn is_dry_run(arg_matches: &Option<&ArgMatches>) -> bool { arg_matches .map(|args| args.is_present("dry_run")) .unwrap_or(false) diff --git a/cli/src/action/rbac/roles.rs b/cli/src/action/rbac/roles.rs index 9c830f094..1b88dda1b 100644 --- a/cli/src/action/rbac/roles.rs +++ b/cli/src/action/rbac/roles.rs @@ -34,7 +34,7 @@ use super::new_client; pub struct ListRolesAction; impl Action for ListRolesAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let format = arg_matches .and_then(|args| args.value_of("format")) .unwrap_or("human"); @@ -72,7 +72,7 @@ impl Action for ListRolesAction { pub struct ShowRoleAction; impl Action for ShowRoleAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let format = arg_matches .and_then(|args| args.value_of("format")) .unwrap_or("human"); @@ -118,7 +118,7 @@ impl Action for ShowRoleAction { pub struct CreateRoleAction; impl Action for CreateRoleAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let role_id = arg_matches .and_then(|args| args.value_of("role_id")) .ok_or_else(|| CliError::ActionError("A role must have an ID".into()))?; @@ -169,7 +169,7 @@ impl Action for CreateRoleAction { pub struct UpdateRoleAction; impl Action for UpdateRoleAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let role_id = arg_matches .and_then(|args| args.value_of("role_id")) .ok_or_else(|| CliError::ActionError("A role ID must be provided.".into()))?; @@ -297,7 +297,7 @@ fn update_role( pub struct DeleteRoleAction; impl Action for DeleteRoleAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let role_id = arg_matches .and_then(|args| args.value_of("role_id")) .ok_or_else(|| CliError::ActionError("A role ID must be specified".into()))?; @@ -310,7 +310,7 @@ impl Action for DeleteRoleAction { } } -fn is_dry_run<'a>(arg_matches: &Option<&ArgMatches<'a>>) -> bool { +fn is_dry_run(arg_matches: &Option<&ArgMatches>) -> bool { arg_matches .map(|args| args.is_present("dry_run")) .unwrap_or(false) diff --git a/cli/src/action/registry/mod.rs b/cli/src/action/registry/mod.rs index 32ffd8f40..63f78e170 100644 --- a/cli/src/action/registry/mod.rs +++ b/cli/src/action/registry/mod.rs @@ -36,7 +36,7 @@ const DEFAULT_OUTPUT_FILE: &str = "./nodes.yaml"; pub struct RegistryGenerateAction; impl Action for RegistryGenerateAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let output_file = args.value_of("file").unwrap_or(DEFAULT_OUTPUT_FILE); @@ -173,7 +173,7 @@ pub struct RegistryAddAction; #[cfg(feature = "registry")] impl Action for RegistryAddAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let url = args diff --git a/cli/src/action/user/mod.rs b/cli/src/action/user/mod.rs index 7984c2a6a..c32b002db 100644 --- a/cli/src/action/user/mod.rs +++ b/cli/src/action/user/mod.rs @@ -27,7 +27,7 @@ use api::{ClientBiomeUser, ClientOAuthUser}; pub struct ListSplinterUsersAction; impl Action for ListSplinterUsersAction { - fn run<'a>(&mut self, arg_matches: Option<&ArgMatches<'a>>) -> Result<(), CliError> { + fn run(&mut self, arg_matches: Option<&ArgMatches>) -> Result<(), CliError> { let args = arg_matches.ok_or(CliError::RequiresArgs)?; let format = args.value_of("format").unwrap_or("human");