diff --git a/cli/src/commit_templater.rs b/cli/src/commit_templater.rs index 71e8e57210..9f20c4644a 100644 --- a/cli/src/commit_templater.rs +++ b/cli/src/commit_templater.rs @@ -41,15 +41,15 @@ use crate::templater::{ }; use crate::text_util; -struct CommitTemplateLanguage<'repo, 'b> { +struct CommitTemplateLanguage<'repo> { repo: &'repo dyn Repo, - workspace_id: &'b WorkspaceId, + workspace_id: WorkspaceId, id_prefix_context: &'repo IdPrefixContext, build_fn_table: CommitTemplateBuildFnTable<'repo>, keyword_cache: CommitKeywordCache, } -impl<'repo> TemplateLanguage<'repo> for CommitTemplateLanguage<'repo, '_> { +impl<'repo> TemplateLanguage<'repo> for CommitTemplateLanguage<'repo> { type Context = Commit; type Property = CommitTemplatePropertyKind<'repo>; @@ -111,7 +111,7 @@ impl<'repo> TemplateLanguage<'repo> for CommitTemplateLanguage<'repo, '_> { // If we need to add multiple languages that support Commit types, this can be // turned into a trait which extends TemplateLanguage. -impl<'repo> CommitTemplateLanguage<'repo, '_> { +impl<'repo> CommitTemplateLanguage<'repo> { fn wrap_commit( &self, property: impl TemplateProperty + 'repo, @@ -226,7 +226,7 @@ impl<'repo> IntoTemplateProperty<'repo, Commit> for CommitTemplatePropertyKind<' // table is bound to a named lifetime, and therefore can't be cached statically. type CommitTemplateBuildMethodFn<'repo, T> = fn( - &CommitTemplateLanguage<'repo, '_>, + &CommitTemplateLanguage<'repo>, &BuildContext>, Box + 'repo>, &FunctionCallNode, @@ -546,7 +546,7 @@ impl Template<()> for Vec { } fn build_ref_name_method<'repo>( - language: &CommitTemplateLanguage<'repo, '_>, + language: &CommitTemplateLanguage<'repo>, _build_ctx: &BuildContext>, self_property: impl TemplateProperty + 'repo, function: &FunctionCallNode, @@ -704,7 +704,7 @@ impl Template<()> for CommitOrChangeId { } fn build_commit_or_change_id_method<'repo>( - language: &CommitTemplateLanguage<'repo, '_>, + language: &CommitTemplateLanguage<'repo>, build_ctx: &BuildContext>, self_property: impl TemplateProperty + 'repo, function: &FunctionCallNode, @@ -775,7 +775,7 @@ impl ShortestIdPrefix { } fn build_shortest_id_prefix_method<'repo>( - language: &CommitTemplateLanguage<'repo, '_>, + language: &CommitTemplateLanguage<'repo>, _build_ctx: &BuildContext>, self_property: impl TemplateProperty + 'repo, function: &FunctionCallNode, @@ -818,7 +818,7 @@ pub fn parse<'repo>( ) -> TemplateParseResult + 'repo>> { let language = CommitTemplateLanguage { repo, - workspace_id, + workspace_id: workspace_id.clone(), id_prefix_context, build_fn_table: CommitTemplateBuildFnTable::builtin(), keyword_cache: CommitKeywordCache::default(), diff --git a/cli/src/operation_templater.rs b/cli/src/operation_templater.rs index 82c1b10d3e..3d4efbba79 100644 --- a/cli/src/operation_templater.rs +++ b/cli/src/operation_templater.rs @@ -31,12 +31,12 @@ use crate::templater::{ TemplatePropertyFn, TimestampRange, }; -struct OperationTemplateLanguage<'b> { - root_op_id: &'b OperationId, - current_op_id: Option<&'b OperationId>, +struct OperationTemplateLanguage { + root_op_id: OperationId, + current_op_id: Option, } -impl TemplateLanguage<'static> for OperationTemplateLanguage<'_> { +impl TemplateLanguage<'static> for OperationTemplateLanguage { type Context = Operation; type Property = OperationTemplatePropertyKind; @@ -67,7 +67,7 @@ impl TemplateLanguage<'static> for OperationTemplateLanguage<'_> { } } -impl OperationTemplateLanguage<'_> { +impl OperationTemplateLanguage { fn wrap_operation( &self, property: impl TemplateProperty + 'static, @@ -133,7 +133,7 @@ fn build_operation_method( let property = match function.name { "current_operation" => { template_parser::expect_no_arguments(function)?; - let current_op_id = language.current_op_id.cloned(); + let current_op_id = language.current_op_id.clone(); language.wrap_boolean(TemplateFunction::new(self_property, move |op| { Some(op.id()) == current_op_id.as_ref() })) @@ -226,8 +226,8 @@ pub fn parse( aliases_map: &TemplateAliasesMap, ) -> TemplateParseResult>> { let language = OperationTemplateLanguage { - root_op_id, - current_op_id, + root_op_id: root_op_id.clone(), + current_op_id: current_op_id.cloned(), }; let node = template_parser::parse(template_text, aliases_map)?; template_builder::build(&language, &node)