Skip to content

Commit

Permalink
Bump serde-yaml to its latest version. (#72)
Browse files Browse the repository at this point in the history
serde-yaml resolves dtolnay/serde-yaml#86 in
0.9.x. This patch bumps it to the latest version to clean up legacy
codes.
  • Loading branch information
higuoxing authored Sep 2, 2024
1 parent 9c3a8b2 commit 4a09e85
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 58 deletions.
80 changes: 31 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dirs = "4.0.*"
tempfile = "3.8.*"
# 1.0.98 doesn't compile under Mac
serde = { version = "1.0.*", features = ["derive"] }
serde_yaml = "0.8.*"
serde_yaml = "0.9.34"
toml_edit = "0.21.*"
shellexpand = "2.1.*"
log = "0.4.*"
Expand Down
10 changes: 2 additions & 8 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,10 @@ impl Default for Config {
pub fn parse(path: PathBuf) -> Config {
let file = std::fs::File::open(path).unwrap();
let reader = std::io::BufReader::new(file);
let mut config = match serde_yaml::from_reader(reader) {
let mut config: Config = match serde_yaml::from_reader(reader) {
Ok(c) => c,
Err(e) => {
// Work around the empty yaml file issue.
// See https://github.com/dtolnay/serde-yaml/issues/86
if e.to_string() != "EOF while parsing a value" {
panic!("{}", e.to_string())
}
Config::default()
panic!("{}", e.to_string())
}
};

Expand Down Expand Up @@ -166,7 +161,6 @@ fonts:
assert_eq!(config.term_config_path, Some("/path/to/config".to_string()));
}


#[test]
fn test_parse_backend_and_deprecated_exe_path() {
let config = parse(make_cfg_file("backend: alacritty\nexe_path: /path/to/alacritty").path);
Expand Down

0 comments on commit 4a09e85

Please sign in to comment.