fix(config): keep runtime field sorting stable

This commit is contained in:
Tunglies
2026-12-03 21:39:21 +08:00
parent 2735282879
commit 1471ad31a5
2 changed files with 2 additions and 2 deletions
@@ -41,7 +41,7 @@ pub fn use_sort(mut config: Mapping) -> Mapping {
let mut sorted = Mapping::new();
HANDLE_FIELDS.into_iter().for_each(|key| {
let key = Value::from(key);
if let Some(value) = config.remove(&key) {
if let Some(value) = config.shift_remove(&key) {
sorted.insert(key, value);
}
});
+1 -1
View File
@@ -947,7 +947,7 @@ mod use_sort_tests {
#[test]
fn sorting_is_stable_when_applied_twice() {
let mut config = Mapping::new();
for key in ["proxies", "mode", "unknown-key", "rules"] {
for key in ["mode", "dns", "tun", "hosts"] {
config.insert(Value::from(key), Value::from(1));
}