refactor: use serde-yml instead of serde-yaml

serde-yml is maintained, -yaml is not.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
Lars Wirzenius
2025-03-26 09:36:51 +02:00
parent dff40e2460
commit 0eecd7b6e4
6 changed files with 11 additions and 30 deletions
Generated
+1 -20
View File
@@ -2120,7 +2120,7 @@ dependencies = [
"radicle-git-ext 0.9.0",
"serde",
"serde_json",
"serde_yaml",
"serde_yml",
"tempfile",
"thiserror 2.0.12",
"time",
@@ -2440,19 +2440,6 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]]
name = "serde_yml"
version = "0.0.12"
@@ -3143,12 +3130,6 @@ dependencies = [
"subtle",
]
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]]
name = "url"
version = "2.5.4"
+1 -1
View File
@@ -19,7 +19,7 @@ radicle-ci-broker = "0.15.1"
radicle-git-ext = "0.9.0"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
serde_yaml = "0.9.27"
serde_yml = "0.0.12"
tempfile = "3.19.1"
thiserror = "2.0.12"
time = { version = "0.3.41", features = ["formatting", "macros"] }
+2 -2
View File
@@ -38,7 +38,7 @@ impl Config {
pub fn read(filename: &Path) -> Result<Self, ConfigError> {
let file = std::fs::File::open(filename)
.map_err(|e| ConfigError::ReadConfig(filename.into(), e))?;
serde_yaml::from_reader(&file).map_err(|e| ConfigError::ParseConfig(filename.into(), e))
serde_yml::from_reader(&file).map_err(|e| ConfigError::ParseConfig(filename.into(), e))
}
/// Return configuration serialized to JSON.
@@ -55,7 +55,7 @@ pub enum ConfigError {
ReadConfig(PathBuf, #[source] std::io::Error),
#[error("failed to parse configuration file as YAML: {0}")]
ParseConfig(PathBuf, #[source] serde_yaml::Error),
ParseConfig(PathBuf, #[source] serde_yml::Error),
#[error("failed to get environment variable {0}")]
GetEnv(&'static str, #[source] std::env::VarError),
+2 -2
View File
@@ -212,7 +212,7 @@ impl RunLog {
}
if let Some(runspec) = &self.runspec {
let text = serde_yaml::to_string(&runspec).map_err(RunLogError::RunSpec)?;
let text = serde_yml::to_string(&runspec).map_err(RunLogError::RunSpec)?;
body.push_child(toc.push(Element::new(Tag::Span).with_child(
Element::new(Tag::Code).with_child(Element::new(Tag::Code).with_text(RUNSPEC_PATH)),
)));
@@ -363,5 +363,5 @@ pub enum RunLogError {
Write(PathBuf, #[source] std::io::Error),
#[error("failed to serialize run spec to YAML")]
RunSpec(#[source] serde_yaml::Error),
RunSpec(#[source] serde_yml::Error),
}
+2 -2
View File
@@ -19,7 +19,7 @@ impl RunSpec {
pub fn from_file(filename: &Path) -> Result<Self, RunSpecError> {
let file = std::fs::File::open(filename)
.map_err(|e| RunSpecError::ReadRunSpec(filename.into(), e))?;
let runspec: RunSpec = serde_yaml::from_reader(&file)
let runspec: RunSpec = serde_yml::from_reader(&file)
.map_err(|e| RunSpecError::ParseRunSpec(filename.into(), e))?;
Ok(runspec)
}
@@ -31,7 +31,7 @@ pub enum RunSpecError {
ReadRunSpec(PathBuf, #[source] std::io::Error),
#[error("failed to parse run spec as YAML: {0}")]
ParseRunSpec(PathBuf, #[source] serde_yaml::Error),
ParseRunSpec(PathBuf, #[source] serde_yml::Error),
#[error(transparent)]
Log(#[from] LogError),
+3 -3
View File
@@ -350,7 +350,7 @@ impl TestCaseBuilder {
std::fs::create_dir(git.path().join(".radicle"))?;
git.write(
".radicle/native.yaml",
&serde_yaml::to_string(&runspec).unwrap(),
&serde_yml::to_string(&runspec).unwrap(),
)?;
// Commit everything.
@@ -365,7 +365,7 @@ impl TestCaseBuilder {
log: tmp.join("log.html"),
base_url: None,
};
let config = serde_yaml::to_string(&config).unwrap();
let config = serde_yml::to_string(&config).unwrap();
std::fs::write(filename, config)?;
} else if let ConfigKind::ValidWithUrl(filename, url) = &config {
let config = Config {
@@ -373,7 +373,7 @@ impl TestCaseBuilder {
log: tmp.join("log.html"),
base_url: Some(url.into()),
};
let config = serde_yaml::to_string(&config).unwrap();
let config = serde_yml::to_string(&config).unwrap();
std::fs::write(filename, config)?;
}