From 4ed3ce0d2b6d85143f5cd07486e7cb2c6b329ff6 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 29 Dec 2024 17:31:28 +0900 Subject: [PATCH] cli: inline CommandHelper::load_template_aliases() There are no external callers, and WorkspaceCommandEnvironment might have to keep a separate copy of UserSettings in order to address #5144. --- cli/src/cli_util.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index e94c8c721..d8b110188 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -347,14 +347,6 @@ impl CommandHelper { &self.data.revset_extensions } - /// Loads template aliases from the configs. - /// - /// For most commands that depend on a loaded repo, you should use - /// `WorkspaceCommandHelper::template_aliases_map()` instead. - fn load_template_aliases(&self, ui: &Ui) -> Result { - load_template_aliases(ui, self.settings().config()) - } - /// Parses template of the given language into evaluation tree. /// /// This function also loads template aliases from the settings. Use @@ -368,7 +360,7 @@ impl CommandHelper { wrap_self: impl Fn(PropertyPlaceholder) -> L::Property, ) -> Result, CommandError> { let mut diagnostics = TemplateDiagnostics::new(); - let aliases = self.load_template_aliases(ui)?; + let aliases = load_template_aliases(ui, self.settings().config())?; let template = template_builder::parse( language, &mut diagnostics, @@ -736,7 +728,7 @@ impl WorkspaceCommandEnvironment { #[instrument(skip_all)] fn new(ui: &Ui, command: &CommandHelper, workspace: &Workspace) -> Result { let revset_aliases_map = revset_util::load_revset_aliases(ui, command.settings().config())?; - let template_aliases_map = command.load_template_aliases(ui)?; + let template_aliases_map = load_template_aliases(ui, command.settings().config())?; let path_converter = RepoPathUiConverter::Fs { cwd: command.cwd().to_owned(), base: workspace.workspace_root().to_owned(),