mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-23 05:58:42 +00:00
Bump toml from 0.5.11 to 0.6.0 (#736)
* Bump toml from 0.5.11 to 0.6.0 Bumps [toml](https://github.com/toml-rs/toml) from 0.5.11 to 0.6.0. - [Release notes](https://github.com/toml-rs/toml/releases) - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.5.11...toml-v0.6.0) --- updated-dependencies: - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Fix use of `toml` v0.6 * Optimize `CratesTomlParseError`: Box variant `TomlParse` Since now `toml:🇩🇪:Error` is a wrapper of `toml_edit::TomlError`, which is at least 3 * `size_of::<Vec<_>>()`. Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
9a2b4c9ab1
commit
425c6c2509
3 changed files with 69 additions and 7 deletions
58
Cargo.lock
generated
58
Cargo.lock
generated
|
@ -247,7 +247,7 @@ dependencies = [
|
|||
"serde_json",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"toml",
|
||||
"toml 0.6.0",
|
||||
"url",
|
||||
]
|
||||
|
||||
|
@ -385,7 +385,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "0f1204fe51a1e56042b8ec31d6407547ecd18f596b66f470dadb9abd9be9c843"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"toml",
|
||||
"toml 0.5.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -671,7 +671,7 @@ checksum = "e62abb876c07e4754fae5c14cafa77937841f01740637e17d78dc04352f32a5e"
|
|||
dependencies = [
|
||||
"cc",
|
||||
"rustc_version",
|
||||
"toml",
|
||||
"toml 0.5.11",
|
||||
"vswhom",
|
||||
"winreg",
|
||||
]
|
||||
|
@ -1476,6 +1476,15 @@ dependencies = [
|
|||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom8"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "normalize-path"
|
||||
version = "0.2.0"
|
||||
|
@ -2127,6 +2136,15 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c68e921cef53841b8925c2abadd27c9b891d9613bdc43d6b823062866df38e8"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_urlencoded"
|
||||
version = "0.7.1"
|
||||
|
@ -2484,6 +2502,40 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fb9d890e4dc9298b70f740f615f2e05b9db37dce531f6b24fb77ac993f9f217"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "729bfd096e40da9c001f778f5cdecbd2957929a24e10e5883d9392220a751581"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"nom8",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
|
|
|
@ -21,7 +21,7 @@ serde = { version = "1.0.152", features = ["derive"] }
|
|||
serde-tuple-vec-map = "1.0.1"
|
||||
serde_json = "1.0.91"
|
||||
thiserror = "1.0.38"
|
||||
toml = "0.5.11"
|
||||
toml = "0.6.0"
|
||||
url = { version = "2.3.1", features = ["serde"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -13,6 +13,7 @@ use std::{
|
|||
io::{self, Seek},
|
||||
iter::IntoIterator,
|
||||
path::{Path, PathBuf},
|
||||
str::{self, Utf8Error},
|
||||
};
|
||||
|
||||
use beef::Cow;
|
||||
|
@ -54,7 +55,7 @@ impl CratesToml<'_> {
|
|||
if vec.is_empty() {
|
||||
Ok(CratesToml::default())
|
||||
} else {
|
||||
toml::from_slice(&vec).map_err(CratesTomlParseError::from)
|
||||
toml::from_str(str::from_utf8(&vec)?).map_err(CratesTomlParseError::from)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +90,7 @@ impl CratesToml<'_> {
|
|||
this: &CratesToml<'_>,
|
||||
writer: &mut dyn io::Write,
|
||||
) -> Result<(), CratesTomlParseError> {
|
||||
let data = toml::to_vec(&this)?;
|
||||
let data = toml::to_string(&this)?.into_bytes();
|
||||
writer.write_all(&data)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -184,8 +185,11 @@ pub enum CratesTomlParseError {
|
|||
#[error(transparent)]
|
||||
Io(#[from] io::Error),
|
||||
|
||||
#[error("Failed to parse toml: File is not in valid utf-8 encodings: {0}")]
|
||||
TomlParseNonUtf8(#[from] Utf8Error),
|
||||
|
||||
#[error(transparent)]
|
||||
TomlParse(#[from] toml::de::Error),
|
||||
TomlParse(Box<toml::de::Error>),
|
||||
|
||||
#[error(transparent)]
|
||||
TomlWrite(Box<toml::ser::Error>),
|
||||
|
@ -206,6 +210,12 @@ impl From<toml::ser::Error> for CratesTomlParseError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<toml::de::Error> for CratesTomlParseError {
|
||||
fn from(e: toml::de::Error) -> Self {
|
||||
CratesTomlParseError::TomlParse(Box::new(e))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Reference in a new issue