diff options
Diffstat (limited to 'alacritty_config_derive')
-rw-r--r-- | alacritty_config_derive/src/de_struct.rs | 8 | ||||
-rw-r--r-- | alacritty_config_derive/tests/config.rs | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/alacritty_config_derive/src/de_struct.rs b/alacritty_config_derive/src/de_struct.rs index ceb32fd9..cf7ea141 100644 --- a/alacritty_config_derive/src/de_struct.rs +++ b/alacritty_config_derive/src/de_struct.rs @@ -135,14 +135,14 @@ fn field_deserializer(field_streams: &mut FieldStreams, field: &Field) -> Result config.#ident = serde::Deserialize::deserialize(unused).unwrap_or_default(); }); }, - "deprecated" => { - // Construct deprecation message and append optional attribute override. - let mut message = format!("Config warning: {} is deprecated", literal); + "deprecated" | "removed" => { + // Construct deprecation/removal message with optional attribute override. + let mut message = format!("Config warning: {} has been {}", literal, parsed.ident); if let Some(warning) = parsed.param { message = format!("{}; {}", message, warning.value()); } - // Append stream to log deprecation warning. + // Append stream to log deprecation/removal warning. match_assignment_stream.extend(quote! { log::warn!(target: #LOG_TARGET, #message); }); diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs index 58ad8bd4..2cdae613 100644 --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -35,6 +35,8 @@ struct Test { enom_big: TestEnum, #[config(deprecated)] enom_error: TestEnum, + #[config(removed = "it's gone")] + gone: bool, } impl Default for Test { @@ -48,6 +50,7 @@ impl Default for Test { enom_small: TestEnum::default(), enom_big: TestEnum::default(), enom_error: TestEnum::default(), + gone: false, } } } @@ -90,6 +93,7 @@ fn config_deserialize() { enom_small: "one" enom_big: "THREE" enom_error: "HugaBuga" + gone: false "#, ) .unwrap(); @@ -101,6 +105,7 @@ fn config_deserialize() { assert_eq!(test.enom_small, TestEnum::One); assert_eq!(test.enom_big, TestEnum::Three); assert_eq!(test.enom_error, Test::default().enom_error); + assert_eq!(test.gone, false); assert_eq!(test.nesting.field1, Test::default().nesting.field1); assert_eq!(test.nesting.field2, None); assert_eq!(test.nesting.field3, Test::default().nesting.field3); @@ -116,8 +121,9 @@ fn config_deserialize() { ]); let warn_logs = logger.warn_logs.lock().unwrap(); assert_eq!(warn_logs.as_slice(), [ - "Config warning: field1 is deprecated; use field2 instead", - "Config warning: enom_error is deprecated", + "Config warning: field1 has been deprecated; use field2 instead", + "Config warning: enom_error has been deprecated", + "Config warning: gone has been removed; it's gone", ]); } |