summaryrefslogtreecommitdiffstats
path: root/alacritty_terminal/src/config/mod.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2019-07-07 14:51:11 +0000
committerGitHub <noreply@github.com>2019-07-07 14:51:11 +0000
commit165246f50aead3a4311df6304830a6e24ef522c8 (patch)
treed4fbec4dfb2a7a51f103aa62aa2c560aceec16be /alacritty_terminal/src/config/mod.rs
parented7ed473da8ad3147eab32d376a37e391ac7e9db (diff)
Fix saving of ref tests
Since ref tests were only stored whenever winit requested the window close, they would not get stored properly when the terminal was closed through Alacritty using `exit`, Ctrl+D or similar. This moves the ref test code to the and of the main entry point, which will always be executed regardless of how the terminal was shutdown.
Diffstat (limited to 'alacritty_terminal/src/config/mod.rs')
-rw-r--r--alacritty_terminal/src/config/mod.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/alacritty_terminal/src/config/mod.rs b/alacritty_terminal/src/config/mod.rs
index 50606ef0..63f0aace 100644
--- a/alacritty_terminal/src/config/mod.rs
+++ b/alacritty_terminal/src/config/mod.rs
@@ -14,8 +14,8 @@
use std::borrow::Cow;
use std::collections::HashMap;
-use std::path::PathBuf;
use std::fmt::Display;
+use std::path::PathBuf;
use serde::{Deserialize, Deserializer};
use serde_yaml::Value;
@@ -402,7 +402,9 @@ impl Default for DefaultTrueBool {
}
fn fallback_default<T, E>(err: E) -> T
- where T: Default, E: Display
+where
+ T: Default,
+ E: Display,
{
error!("Problem with config: {}; using default value", err);
T::default()
@@ -417,20 +419,24 @@ where
}
pub fn option_explicit_none<'de, T, D>(deserializer: D) -> Result<Option<T>, D::Error>
- where D: Deserializer<'de>, T: Deserialize<'de> + Default
+where
+ D: Deserializer<'de>,
+ T: Deserialize<'de> + Default,
{
Ok(match Value::deserialize(deserializer)? {
Value::String(ref value) if value.to_lowercase() == "none" => None,
- value => Some(T::deserialize(value).unwrap_or_else(fallback_default))
+ value => Some(T::deserialize(value).unwrap_or_else(fallback_default)),
})
}
pub fn from_string_or_deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error>
- where D: Deserializer<'de>, T: Deserialize<'de> + FromString + Default
+where
+ D: Deserializer<'de>,
+ T: Deserialize<'de> + FromString + Default,
{
Ok(match Value::deserialize(deserializer)? {
Value::String(value) => T::from(value),
- value => T::deserialize(value).unwrap_or_else(fallback_default)
+ value => T::deserialize(value).unwrap_or_else(fallback_default),
})
}