Skip to content

Commit

Permalink
Fix "needless_lifetimes" lint error
Browse files Browse the repository at this point in the history
Signed-off-by: Shawn T. Amundson <[email protected]>
  • Loading branch information
vaporos committed Jan 29, 2024
1 parent cdaf898 commit b0f4335
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion cli/src/action/certs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand Down
18 changes: 9 additions & 9 deletions cli/src/action/circuit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions cli/src/action/circuit/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/action/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion cli/src/action/database/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion cli/src/action/database/upgrade/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/action/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cli/src/action/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ValidatedGroupOptions> = args
.value_of("group")
Expand Down
6 changes: 3 additions & 3 deletions cli/src/action/maintenance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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(())
Expand All @@ -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(())
Expand Down
4 changes: 2 additions & 2 deletions cli/src/action/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion cli/src/action/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
14 changes: 7 additions & 7 deletions cli/src/action/rbac/assignments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -321,7 +321,7 @@ fn display_human_readable(assignment: &Assignment) {
}
}

fn get_identity_arg<'a>(arg_matches: &Option<&ArgMatches<'a>>) -> Result<Identity, CliError> {
fn get_identity_arg(arg_matches: &Option<&ArgMatches>) -> Result<Identity, CliError> {
if let Some(key) = arg_matches
.and_then(|args| args.value_of("id_key"))
.map(|s| s.to_string())
Expand All @@ -341,7 +341,7 @@ fn get_identity_arg<'a>(arg_matches: &Option<&ArgMatches<'a>>) -> Result<Identit
))
}

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)
Expand Down
12 changes: 6 additions & 6 deletions cli/src/action/rbac/roles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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()))?;
Expand Down Expand Up @@ -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()))?;
Expand Down Expand Up @@ -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()))?;
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cli/src/action/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cli/src/action/user/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit b0f4335

Please sign in to comment.