Skip to content

Commit 7e11f1e

Browse files
committed
[nextest-runner] switch to toml_edit for parsing toml
This is needed for upcoming changes which check that TOML passed in over `--config` is always of the form KEY=VALUE.
1 parent 2441b49 commit 7e11f1e

File tree

4 files changed

+34
-11
lines changed

4 files changed

+34
-11
lines changed

Cargo.lock

Lines changed: 23 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nextest-runner/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ tokio = { version = "1.20.1", features = [
5858
"sync",
5959
"time",
6060
] }
61-
toml = "0.5.9"
61+
toml_edit = { version = "0.14.4", features = ["easy"] }
6262
twox-hash = { version = "1.6.3", default-features = false }
6363
zstd = { version = "0.11.2", features = ["zstdmt"] }
6464

nextest-runner/src/cargo_config.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fn parse_cli_configs(
221221
.map(|config_str| {
222222
// Each cargo config is expected to be a valid TOML file.
223223
let config_str = config_str.as_ref();
224-
let config = toml::from_str(config_str).map_err(|error| {
224+
let config = toml_edit::easy::from_str(config_str).map_err(|error| {
225225
CargoConfigsConstructError::CliConfigParseError {
226226
config_str: config_str.to_owned(),
227227
error,
@@ -310,12 +310,13 @@ fn discover_impl(
310310
error,
311311
}
312312
})?;
313-
let config: CargoConfig = toml::from_str(&config_contents).map_err(|error| {
314-
CargoConfigSearchError::ConfigParseError {
315-
path: path.clone(),
316-
error,
317-
}
318-
})?;
313+
let config: CargoConfig =
314+
toml_edit::easy::from_str(&config_contents).map_err(|error| {
315+
CargoConfigSearchError::ConfigParseError {
316+
path: path.clone(),
317+
error,
318+
}
319+
})?;
319320
Ok((CargoConfigSource::File(path), config))
320321
})
321322
.collect::<Result<Vec<_>, CargoConfigSearchError>>()?;

nextest-runner/src/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ pub enum CargoConfigsConstructError {
804804

805805
/// The error that occurred trying to deserialize the config.
806806
#[source]
807-
error: toml::de::Error,
807+
error: toml_edit::easy::de::Error,
808808
},
809809
}
810810

@@ -850,7 +850,7 @@ pub enum CargoConfigSearchError {
850850

851851
/// The error that occurred trying to deserialize the config file
852852
#[source]
853-
error: toml::de::Error,
853+
error: toml_edit::easy::de::Error,
854854
},
855855
}
856856

0 commit comments

Comments
 (0)