From 9690ce5e872f1873538b8cea7c93fa3ea8bfd9d1 Mon Sep 17 00:00:00 2001 From: crowlKats <13135287+crowlKats@users.noreply.github.com> Date: Tue, 2 Feb 2021 18:16:24 +0100 Subject: refactor(runtime): remove unneeded Deserialize trait for Permissions struct (#9362) --- runtime/permissions.rs | 51 +------------------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/runtime/permissions.rs b/runtime/permissions.rs index fdb3a425b..f9c74a253 100644 --- a/runtime/permissions.rs +++ b/runtime/permissions.rs @@ -68,7 +68,7 @@ pub struct UnaryPermission { pub denied_list: HashSet, } -#[derive(Clone, Debug, Default, Deserialize, PartialEq)] +#[derive(Clone, Debug, Default, PartialEq)] pub struct Permissions { pub read: UnaryPermission, pub write: UnaryPermission, @@ -749,7 +749,6 @@ fn format_host>(host: &(T, Option)) -> String { #[cfg(test)] mod tests { use super::*; - use deno_core::serde_json; // Creates vector of strings, Vec macro_rules! svec { @@ -1064,54 +1063,6 @@ mod tests { } } - #[test] - fn test_deserialize_perms() { - let json_perms = r#" - { - "read": { - "global_state": "Granted", - "granted_list": [], - "denied_list": [] - }, - "write": { - "global_state": "Granted", - "granted_list": [], - "denied_list": [] - }, - "net": { - "global_state": "Granted", - "granted_list": [], - "denied_list": [] - }, - "env": "Granted", - "run": "Granted", - "plugin": "Granted", - "hrtime": "Granted" - } - "#; - let perms0 = Permissions { - read: UnaryPermission { - global_state: PermissionState::Granted, - ..Default::default() - }, - write: UnaryPermission { - global_state: PermissionState::Granted, - ..Default::default() - }, - net: UnaryPermission { - global_state: PermissionState::Granted, - ..Default::default() - }, - env: PermissionState::Granted, - run: PermissionState::Granted, - hrtime: PermissionState::Granted, - plugin: PermissionState::Granted, - }; - let deserialized_perms: Permissions = - serde_json::from_str(json_perms).unwrap(); - assert_eq!(perms0, deserialized_perms); - } - #[test] fn test_query() { let perms1 = Permissions { -- cgit v1.2.3