aboutsummaryrefslogtreecommitdiff
path: root/alacritty_config_derive
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty_config_derive')
-rw-r--r--alacritty_config_derive/src/config_deserialize/de_struct.rs1
-rw-r--r--alacritty_config_derive/tests/config.rs19
2 files changed, 10 insertions, 10 deletions
diff --git a/alacritty_config_derive/src/config_deserialize/de_struct.rs b/alacritty_config_derive/src/config_deserialize/de_struct.rs
index d2a7dd82..ad38863e 100644
--- a/alacritty_config_derive/src/config_deserialize/de_struct.rs
+++ b/alacritty_config_derive/src/config_deserialize/de_struct.rs
@@ -155,6 +155,7 @@ fn field_deserializer(field_streams: &mut FieldStreams, field: &Field) -> Result
if let Some(warning) = parsed.param {
message = format!("{}; {}", message, warning.value());
}
+ message.push_str("\nUse `alacritty migrate` to automatically resolve it");
// Append stream to log deprecation/removal warning.
match_assignment_stream.extend(quote! {
diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs
index 27a968ed..be140cbe 100644
--- a/alacritty_config_derive/tests/config.rs
+++ b/alacritty_config_derive/tests/config.rs
@@ -1,4 +1,4 @@
-use std::sync::{Arc, Mutex};
+use std::sync::{Arc, Mutex, OnceLock};
use log::{Level, Log, Metadata, Record};
use serde::Deserialize;
@@ -83,10 +83,8 @@ struct NewType(usize);
#[test]
fn config_deserialize() {
- let logger = unsafe {
- LOGGER = Some(Logger::default());
- LOGGER.as_mut().unwrap()
- };
+ static LOGGER: OnceLock<Logger> = OnceLock::new();
+ let logger = LOGGER.get_or_init(Logger::default);
log::set_logger(logger).unwrap();
log::set_max_level(log::LevelFilter::Warn);
@@ -134,15 +132,16 @@ fn config_deserialize() {
]);
let warn_logs = logger.warn_logs.lock().unwrap();
assert_eq!(warn_logs.as_slice(), [
- "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",
+ "Config warning: field1 has been deprecated; use field2 instead\nUse `alacritty migrate` \
+ to automatically resolve it",
+ "Config warning: enom_error has been deprecated\nUse `alacritty migrate` to automatically \
+ resolve it",
+ "Config warning: gone has been removed; it's gone\nUse `alacritty migrate` to \
+ automatically resolve it",
"Unused config key: field3",
]);
}
-static mut LOGGER: Option<Logger> = None;
-
/// Logger storing all messages for later validation.
#[derive(Default)]
struct Logger {