aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Keeler <mjkeeler7@gmail.com>2018-08-07 16:34:53 -0400
committerMatt Keeler <mjkeeler7@gmail.com>2018-08-07 16:34:53 -0400
commit3f4333fa6ee384e5db58f4204ed5f09d9d95cbbb (patch)
treee54f7107e8f14478bf9743909285b2bf94f2d875
parentbf46189993bee96bad3af77938b582b969818228 (diff)
downloadalacritty-3f4333fa6ee384e5db58f4204ed5f09d9d95cbbb.tar.gz
alacritty-3f4333fa6ee384e5db58f4204ed5f09d9d95cbbb.zip
Don’t panic if config contains scale_with_dpi
Insted emit a warning. Note that without the bool::deserialize call the config parser seems to error out and throw away all of the config. Someone more experienced with serde’s internals than myself might know why. Regardless I added that and it fixed it while also having the side effect of quieting clippy regarding not using the input parameter that is passed by value.
-rw-r--r--src/config.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/config.rs b/src/config.rs
index 88ba0ae8..885df16e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1590,13 +1590,15 @@ pub struct Font {
scale_with_dpi: Option<()>,
}
-fn deserialize_scale_with_dpi<'a, D>(_deserializer: D) -> ::std::result::Result<Option<()>, D::Error>
+fn deserialize_scale_with_dpi<'a, D>(deserializer: D) -> ::std::result::Result<Option<()>, D::Error>
where D: de::Deserializer<'a>
{
- panic!(
- "The `scale_with_dpi` field has been deprecated, \
- on X11 the WINIT_HIDPI_FACTOR environment variable can be used instead."
- );
+ // This seems to be necessary in order for the config containing this entry to be parsed properly
+ let _ignored = bool::deserialize(deserializer);
+ eprintln!(
+ "The `scale_with_dpi` setting has been removed, \
+ on X11 the WINIT_HIDPI_FACTOR environment variable can be used instead.");
+ Ok(None)
}
fn default_bold_desc() -> FontDescription {