- }
-
- impl Conf {
- /// Set the property `name` (which must be the `toml` name) to the given value
- #[allow(cast_sign_loss)]
- fn set(&mut self, name: String, value: toml::Value) -> Result<(), Error> {
- match name.as_str() {
- $(
- define_Conf!(PAT $toml_name) => {
- if let Some(value) = define_Conf!(CONV $($ty)+, value) {
- self.$rust_name = value;
- }
- else {
- return Err(Error::Type(define_Conf!(EXPR $toml_name),
- stringify!($($ty)+),
- value.type_str()));
- }
- },
- )+
- "third-party" => {
- // for external tools such as clippy-service
- return Ok(());
- }
- _ => {
- return Err(Error::UnknownKey(name));
+ $(
+ mod $rust_name {
+ use serde;
+ use serde::Deserialize;
+ pub fn deserialize<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<define_Conf!(TY $($ty)+), D::Error> {
+ type T = define_Conf!(TY $($ty)+);
+ Ok(T::deserialize(deserializer).unwrap_or_else(|e| {
+ ::utils::conf::ERRORS.lock().expect("no threading here").push(::utils::conf::Error::Toml(e.to_string()));
+ super::$rust_name()
+ }))