diff --git a/meli/src/conf/data_types/dotaddressable.rs b/meli/src/conf/data_types/dotaddressable.rs index 1e881d19..6ff58c26 100644 --- a/meli/src/conf/data_types/dotaddressable.rs +++ b/meli/src/conf/data_types/dotaddressable.rs @@ -43,6 +43,7 @@ impl DotAddressable for bool {} impl DotAddressable for String {} impl DotAddressable for char {} impl DotAddressable for data_types::IndexStyle {} +impl DotAddressable for data_types::SearchBackend {} impl DotAddressable for u64 {} impl DotAddressable for TagHash {} impl DotAddressable for crate::terminal::Color {} @@ -54,7 +55,6 @@ impl DotAddressable for melib::LogLevel {} impl DotAddressable for PathBuf {} impl DotAddressable for ToggleFlag {} impl DotAddressable for ActionFlag {} -impl DotAddressable for data_types::SearchBackend {} impl DotAddressable for melib::SpecialUsageMailbox {} impl DotAddressable for Option {} impl DotAddressable for Vec {} diff --git a/meli/src/conf/data_types/mod.rs b/meli/src/conf/data_types/mod.rs index e657d7cf..98cf043d 100644 --- a/meli/src/conf/data_types/mod.rs +++ b/meli/src/conf/data_types/mod.rs @@ -41,11 +41,16 @@ impl<'de> Deserialize<'de> for IndexStyle { { let s = ::deserialize(deserializer)?; match s.as_str() { - "Plain" | "plain" => Ok(Self::Plain), - "Threaded" | "threaded" => Ok(Self::Threaded), - "Compact" | "compact" => Ok(Self::Compact), - "Conversations" | "conversations" => Ok(Self::Conversations), - _ => Err(de::Error::custom("invalid `index_style` value")), + plain if plain.eq_ignore_ascii_case("plain") => Ok(Self::Plain), + threaded if threaded.eq_ignore_ascii_case("threaded") => Ok(Self::Threaded), + compact if compact.eq_ignore_ascii_case("compact") => Ok(Self::Compact), + conversations if conversations.eq_ignore_ascii_case("conversations") => { + Ok(Self::Conversations) + } + _ => Err(de::Error::custom( + "invalid `index_style` value, expected one of: \"plain\", \"threaded\", \ + \"compact\" or \"conversations\".", + )), } } } @@ -94,7 +99,12 @@ impl<'de> Deserialize<'de> for SearchBackend { Ok(Self::None) } auto if auto.eq_ignore_ascii_case("auto") => Ok(Self::Auto), - _ => Err(de::Error::custom("invalid `search_backend` value")), + _ => Err(de::Error::custom(if cfg!(feature = "sqlite3") { + "invalid `search_backend` value, expected one of: \"sqlite3\", \"sqlite\", \ + \"none\" or \"auto\"." + } else { + "invalid `search_backend` value, expected one of: \"none\" or \"auto\"." + })), } } }