From 46625984f3645278810bf0bfb31c94705d102267 Mon Sep 17 00:00:00 2001 From: Sosthene Date: Fri, 6 Dec 2024 15:22:43 +0100 Subject: [PATCH] Remove dead code --- src/pcd.rs | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) diff --git a/src/pcd.rs b/src/pcd.rs index 6c35467..54f3a50 100644 --- a/src/pcd.rs +++ b/src/pcd.rs @@ -471,55 +471,6 @@ impl RoleDefinition { } } -pub fn compare_maps(map1: &Map, map2: &Map) -> bool { - // First, check if both maps have the same keys - if map1.keys().collect::>() != map2.keys().collect::>() { - return false; - } - - // Then, check if the corresponding values have the same type - for key in map1.keys() { - let value1 = map1.get(key).unwrap(); - let value2 = map2.get(key).unwrap(); - - if !compare_values(value1, value2) { - return false; - } - } - - true -} - -fn compare_values(value1: &Value, value2: &Value) -> bool { - if value1.is_null() && value2.is_null() { - return true; - } else if value1.is_boolean() && value2.is_boolean() { - return true; - } else if value1.is_number() && value2.is_number() { - return true; - } else if value1.is_string() && value2.is_string() { - return true; - } else if value1.is_array() && value2.is_array() { - return compare_arrays(value1.as_array().unwrap(), value2.as_array().unwrap()); - } else if value1.is_object() && value2.is_object() { - // Recursive comparison for nested objects - return compare_maps(value1.as_object().unwrap(), value2.as_object().unwrap()); - } else { - return false; - } -} - -fn compare_arrays(array1: &Vec, array2: &Vec) -> bool { - // Compare the type of each element in the arrays - for (elem1, elem2) in array1.iter().zip(array2.iter()) { - if !compare_values(elem1, elem2) { - return false; - } - } - - true -} - #[cfg(test)] mod tests { use std::str::FromStr;