From 28539f54ccb4c69fc6ce02de28ef34f2de7fddf4 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Thu, 17 Jul 2025 11:49:44 -0500 Subject: [PATCH] Use the get_table util to extract "[all]" table I built the function for this purpose and then forgot to use it. I remembered after doing the per-project bit, so here's the refactor. --- src/config.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/config.rs b/src/config.rs index d3dc827..51e1732 100644 --- a/src/config.rs +++ b/src/config.rs @@ -54,17 +54,14 @@ fn lconf(text: &str) -> Result { let cfg_table = toml_val.as_table().ok_or(Error::BadFormat)?; // Get the global config out of the file - if let Some(section_all) = cfg_table.get("all") { - if let Some(table_all) = section_all.as_table() { - whole.all = PartialConfig { - project_path: None, // There is no global project path. That's nonsense. - gitea_url: get_maybe_property(&table_all, "gitea_url")?.cloned(), - owner: get_maybe_property(&table_all, "owner")?.cloned(), - repo: get_maybe_property(&table_all, "repo")?.cloned(), - token: get_maybe_property(&table_all, "token")?.cloned(), - }; - } - } + let table_all = get_table(cfg_table, "all")?; + whole.all = PartialConfig { + project_path: None, // There is no global project path. That's nonsense. + gitea_url: get_maybe_property(&table_all, "gitea_url")?.cloned(), + owner: get_maybe_property(&table_all, "owner")?.cloned(), + repo: get_maybe_property(&table_all, "repo")?.cloned(), + token: get_maybe_property(&table_all, "token")?.cloned(), + }; // Loop over the per-project configs, if any. let per_project_keys = cfg_table