mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-04 05:00:05 +08:00
fix(config): keep runtime field sorting stable
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user