From 4fa998357697ae063d0ab9126b1375d47dfa98f0 Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Thu, 3 Dec 2026 20:56:45 +0800 Subject: [PATCH] refactor(runtime-bundle): share provider section order --- crates/clash-verge-runtime-bundle/src/lib.rs | 32 +++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/crates/clash-verge-runtime-bundle/src/lib.rs b/crates/clash-verge-runtime-bundle/src/lib.rs index 0e904d7f3..6813da12b 100644 --- a/crates/clash-verge-runtime-bundle/src/lib.rs +++ b/crates/clash-verge-runtime-bundle/src/lib.rs @@ -9,6 +9,8 @@ use std::collections::{BTreeMap, HashSet}; use std::path::{Component, Path, PathBuf, Prefix}; use tristr::TriStr; +const PROVIDER_SECTIONS: [&str; 2] = ["proxy-providers", "rule-providers"]; + pub const GEO_ASSETS: &[&str] = &[ "Country.mmdb", "ASN.mmdb", @@ -59,7 +61,7 @@ pub fn remote_providers_of(config: &Mapping, config_root: &Path) -> Result::new(); let mut reserved: HashSet = GEO_ASSETS.iter().copied().map(TriStr::from).collect(); - for section in ["proxy-providers", "rule-providers"] { + for section in PROVIDER_SECTIONS { let Some(providers) = config.get(section).and_then(Value::as_mapping) else { continue; }; @@ -172,22 +174,16 @@ fn collect_runtime_parts(mut config: Value, config_root: &Path) -> Result