Fix compatibility with toml 0.6.0

`toml::from_slice` has been removed. The CHANGELOG recommends using
`toml::from_str` instead and doing the byte-to-str conversion yourself.

The `toml::toml!` macro has also changed to return the type of the
value declared within the macro body. In the change in
`helix-view/src/theme.rs` this is a `toml::map::Map` (it was a
`toml::Value` previously) allowing us to skip the match and use the
map directly.

Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
pull/5185/head
Michael Davis 2 years ago
parent 52d854fa62
commit b3e9f6233a

@ -28,8 +28,8 @@ fn test_treesitter_indent(file_name: &str, lang_scope: &str) {
let mut config_file = test_dir; let mut config_file = test_dir;
config_file.push("languages.toml"); config_file.push("languages.toml");
let config = std::fs::read(config_file).unwrap(); let config = std::fs::read_to_string(config_file).unwrap();
let config = toml::from_slice(&config).unwrap(); let config = toml::from_str(&config).unwrap();
let loader = Loader::new(config); let loader = Loader::new(config);
// set runtime path so we can find the queries // set runtime path so we can find the queries

@ -517,11 +517,9 @@ mod tests {
let mut style = Style::default(); let mut style = Style::default();
let palette = ThemePalette::default(); let palette = ThemePalette::default();
if let Value::Table(entries) = table { for (_name, value) in table {
for (_name, value) in entries {
palette.parse_style(&mut style, value).unwrap(); palette.parse_style(&mut style, value).unwrap();
} }
}
assert_eq!( assert_eq!(
style, style,

Loading…
Cancel
Save