From 071f9959a697979c4670b9595aeea886e2de9c6f Mon Sep 17 00:00:00 2001 From: strawberry Date: Sun, 24 Dec 2023 00:37:23 -0500 Subject: [PATCH] remove false_fn as just default alone always evaluates to false ideally we could just do true/false but it is almost 2024 and this is not possible in serde. Signed-off-by: strawberry --- src/config/mod.rs | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 2e9be567..38458860 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -48,20 +48,20 @@ pub struct Config { pub max_concurrent_requests: u16, #[serde(default = "default_max_fetch_prev_events")] pub max_fetch_prev_events: u16, - #[serde(default = "false_fn")] + #[serde(default)] pub allow_registration: bool, - #[serde(default = "false_fn")] + #[serde(default)] pub yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse: bool, pub registration_token: Option, #[serde(default = "true_fn")] pub allow_encryption: bool, - #[serde(default = "false_fn")] + #[serde(default)] pub allow_federation: bool, - #[serde(default = "false_fn")] + #[serde(default)] pub allow_public_room_directory_over_federation: bool, - #[serde(default = "false_fn")] + #[serde(default)] pub allow_public_room_directory_without_auth: bool, - #[serde(default = "false_fn")] + #[serde(default)] pub allow_device_name_federation: bool, #[serde(default = "true_fn")] pub allow_room_creation: bool, @@ -70,9 +70,9 @@ pub struct Config { #[serde(default = "default_default_room_version")] pub default_room_version: RoomVersionId, pub well_known_client: Option, - #[serde(default = "false_fn")] + #[serde(default)] pub allow_jaeger: bool, - #[serde(default = "false_fn")] + #[serde(default)] pub tracing_flame: bool, #[serde(default)] pub proxy: ProxyConfig, @@ -99,7 +99,7 @@ pub struct Config { pub rocksdb_max_log_file_size: usize, #[serde(default = "default_rocksdb_log_time_to_roll")] pub rocksdb_log_time_to_roll: usize, - #[serde(default = "false_fn")] + #[serde(default)] pub rocksdb_optimize_for_spinning_disks: bool, pub emergency_password: Option, @@ -107,21 +107,21 @@ pub struct Config { #[serde(default = "default_notification_push_path")] pub notification_push_path: String, - #[serde(default = "false_fn")] + #[serde(default)] pub allow_local_presence: bool, - #[serde(default = "false_fn")] + #[serde(default)] pub allow_incoming_presence: bool, - #[serde(default = "false_fn")] + #[serde(default)] pub allow_outgoing_presence: bool, #[serde(default = "default_presence_idle_timeout_s")] pub presence_idle_timeout_s: u64, #[serde(default = "default_presence_offline_timeout_s")] pub presence_offline_timeout_s: u64, - #[serde(default = "false_fn")] + #[serde(default)] pub zstd_compression: bool, - #[serde(default = "false_fn")] + #[serde(default)] pub allow_guest_registration: bool, #[serde(flatten)] @@ -307,10 +307,6 @@ impl fmt::Display for Config { } } -fn false_fn() -> bool { - false -} - fn true_fn() -> bool { true }