From 6e0d6c78fb67539d5230c60a17d4bab33366ca8a Mon Sep 17 00:00:00 2001 From: strawberry Date: Fri, 22 Mar 2024 23:42:22 -0400 Subject: [PATCH] use BTreeMap again Signed-off-by: strawberry --- src/config/mod.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 7e0b6dc5..b3aa74a8 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -1,5 +1,5 @@ use std::{ - collections::BTreeSet, + collections::BTreeMap, fmt::{self, Write as _}, net::{IpAddr, Ipv4Addr}, path::PathBuf, @@ -10,7 +10,7 @@ use figment::Figment; use itertools::Itertools; use regex::RegexSet; use ruma::{OwnedRoomId, OwnedServerName, RoomVersionId}; -use serde::Deserialize; +use serde::{de::IgnoredAny, Deserialize}; use tracing::{debug, error, warn}; use self::proxy::ProxyConfig; @@ -216,7 +216,8 @@ pub struct Config { pub block_non_admin_invites: bool, #[serde(flatten)] - pub catchall: BTreeSet, + #[allow(clippy::zero_sized_map_values)] // this is a catchall, the map shouldn't be zero at runtime + pub catchall: BTreeMap, } #[derive(Clone, Debug, Deserialize)] @@ -238,7 +239,7 @@ impl Config { pub fn warn_deprecated(&self) { debug!("Checking for deprecated config keys"); let mut was_deprecated = false; - for key in self.catchall.iter().filter(|key| DEPRECATED_KEYS.iter().any(|s| s == key)) { + for key in self.catchall.keys().filter(|key| DEPRECATED_KEYS.iter().any(|s| s == key)) { warn!("Config parameter \"{}\" is deprecated, ignoring.", key); was_deprecated = true; } @@ -256,7 +257,7 @@ impl Config { pub fn warn_unknown_key(&self) { debug!("Checking for unknown config keys"); for key in - self.catchall.iter().filter(|key| "config".to_owned().ne(key.to_owned()) /* "config" is expected */) + self.catchall.keys().filter(|key| "config".to_owned().ne(key.to_owned()) /* "config" is expected */) { warn!("Config parameter \"{}\" is unknown to conduwuit, ignoring.", key); }