Skip to content

Commit d3255a3

Browse files
authored
Merge pull request #1080 from mrcjkb/mj/push-uorxxkqtkrxu
fix: stop depending on unmaintained/unsound serde_yml
2 parents f360ff2 + 9b43063 commit d3255a3

8 files changed

Lines changed: 18 additions & 36 deletions

File tree

Cargo.lock

Lines changed: 7 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fern = "0.7.1"
3131
chrono = "0.4.44"
3232
tokio-util = "0.7.16"
3333
walkdir = "2.5.0"
34-
serde_yml = "0.0.12"
34+
serde_yaml_ng = "0.10"
3535
dirs = "6"
3636
wax = "0.6.0"
3737
percent-encoding = "2.3"

crates/emmylua_formatter/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ serde.workspace = true
1919
emmylua_parser.workspace = true
2020
rowan.workspace = true
2121
serde_json.workspace = true
22-
serde_yml.workspace = true
22+
serde_yaml_ng.workspace = true
2323
toml_edit.workspace = true
2424
smol_str.workspace = true
2525
glob.workspace = true

crates/emmylua_formatter/src/workspace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ pub fn parse_format_config(
256256
message: err.to_string(),
257257
}
258258
}),
259-
"yml" | "yaml" => serde_yml::from_str::<LuaFormatConfig>(content).map_err(|err| {
259+
"yml" | "yaml" => serde_yaml_ng::from_str::<LuaFormatConfig>(content).map_err(|err| {
260260
FormatterError::ConfigParse {
261261
path: path.map(Path::to_path_buf),
262262
message: err.to_string(),
@@ -388,7 +388,7 @@ fn try_parse_unknown_config_format(
388388
) -> Result<LuaFormatConfig, FormatterError> {
389389
from_toml_str::<LuaFormatConfig>(content)
390390
.or_else(|_| serde_json::from_str::<LuaFormatConfig>(content))
391-
.or_else(|_| serde_yml::from_str::<LuaFormatConfig>(content))
391+
.or_else(|_| serde_yaml_ng::from_str::<LuaFormatConfig>(content))
392392
.map_err(|err| FormatterError::ConfigParse {
393393
path: path.map(Path::to_path_buf),
394394
message: format!("unknown extension, failed to parse as TOML/JSON/YAML: {err}"),

crates/emmylua_ls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ rowan.workspace = true
3636
walkdir.workspace = true
3737
rust-i18n.workspace = true
3838
glob.workspace = true
39-
serde_yml.workspace = true
39+
serde_yaml_ng.workspace = true
4040
itertools.workspace = true
4141
dirs.workspace = true
4242
wax.workspace = true

crates/emmylua_ls/src/handlers/initialized/std_i18n.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ fn translate_one_std_file(locale: &str, rel_lua_path: &Path, content: &str) -> O
215215
fn read_meta(path_in_dir: &str) -> Option<MetaFile> {
216216
let file = STD_I18N_DIR.get_file(path_in_dir)?;
217217
let raw = file.contents_utf8()?;
218-
serde_yml::from_str(raw).ok()
218+
serde_yaml_ng::from_str(raw).ok()
219219
}
220220

221221
fn read_translations(path_in_dir: &str) -> Option<HashMap<String, String>> {
222222
let file = STD_I18N_DIR.get_file(path_in_dir)?;
223223
let raw = file.contents_utf8()?;
224-
serde_yml::from_str(raw).ok()
224+
serde_yaml_ng::from_str(raw).ok()
225225
}
226226

227227
fn apply_meta_translations(
@@ -1214,7 +1214,7 @@ function coroutine.status(co) end
12141214
.get_file("coroutine/meta.yaml")
12151215
.expect("generated coroutine meta exists");
12161216
let meta: MetaFile =
1217-
serde_yml::from_str(file.contents_utf8().expect("meta is utf8")).unwrap();
1217+
serde_yaml_ng::from_str(file.contents_utf8().expect("meta is utf8")).unwrap();
12181218

12191219
assert_eq!(meta.v, 2);
12201220
assert!(meta.b.iter().flat_map(|block| &block.e).any(|entry| {
@@ -1230,7 +1230,7 @@ function coroutine.status(co) end
12301230
.get_file("coroutine/meta.yaml")
12311231
.expect("generated coroutine meta exists");
12321232
let meta: MetaFile =
1233-
serde_yml::from_str(file.contents_utf8().expect("meta is utf8")).unwrap();
1233+
serde_yaml_ng::from_str(file.contents_utf8().expect("meta is utf8")).unwrap();
12341234
let source = emmylua_code_analysis::load_resource_from_include_dir()
12351235
.into_iter()
12361236
.find(|file| file.path == "std/coroutine.lua")

tools/std_i18n/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ emmylua_parser.workspace = true
99

1010
# external
1111
serde.workspace = true
12-
serde_yml.workspace = true
12+
serde_yaml_ng.workspace = true
1313
walkdir.workspace = true

tools/std_i18n/src/locale_yaml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn read_yaml_string_map(
6969
return Ok(HashMap::new());
7070
}
7171
let raw = fs::read_to_string(path)?;
72-
let map: HashMap<String, String> = serde_yml::from_str(&raw)?;
72+
let map: HashMap<String, String> = serde_yaml_ng::from_str(&raw)?;
7373
Ok(map)
7474
}
7575

0 commit comments

Comments
 (0)