Skip to content

Commit

Permalink
Replace dep toml_edit with toml v0.5.10 in binstalk-manifests
Browse files Browse the repository at this point in the history
to speed up compilation and reduce bloat.

Previously we switch to toml_edit because it is unmaintained, but now
with it moved into toml-rs/toml as a workspace, it is now under active
maintenance again, thus we switch back to it.

Signed-off-by: Jiahao XU <[email protected]>
  • Loading branch information
NobodyXu committed Dec 19, 2022
1 parent 6ff3ba7 commit 3adc4a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 42 deletions.
38 changes: 3 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/binstalk-manifests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ serde = { version = "1.0.151", features = ["derive"] }
serde-tuple-vec-map = "1.0.1"
serde_json = "1.0.91"
thiserror = "1.0.37"
toml_edit = { version = "0.15.0", features = ["easy"] }
toml = "0.5.10"
url = { version = "2.3.1", features = ["serde"] }

[dev-dependencies]
Expand Down
12 changes: 6 additions & 6 deletions crates/binstalk-manifests/src/cargo_crates_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl CratesToml<'_> {
pub fn load_from_reader<R: io::Read>(mut reader: R) -> Result<Self, CratesTomlParseError> {
let mut vec = Vec::new();
reader.read_to_end(&mut vec)?;
Ok(toml_edit::easy::from_slice(&vec)?)
Ok(toml::from_slice(&vec)?)
}

pub fn load_from_path(path: impl AsRef<Path>) -> Result<Self, CratesTomlParseError> {
Expand All @@ -76,7 +76,7 @@ impl CratesToml<'_> {
}

pub fn write_to_writer<W: io::Write>(&self, mut writer: W) -> Result<(), CratesTomlParseError> {
let data = toml_edit::easy::to_vec(&self)?;
let data = toml::to_vec(&self)?;
writer.write_all(&data)?;
Ok(())
}
Expand Down Expand Up @@ -159,10 +159,10 @@ pub enum CratesTomlParseError {
Io(#[from] io::Error),

#[error(transparent)]
TomlParse(#[from] toml_edit::easy::de::Error),
TomlParse(#[from] toml::de::Error),

#[error(transparent)]
TomlWrite(Box<toml_edit::easy::ser::Error>),
TomlWrite(Box<toml::ser::Error>),

#[error(transparent)]
CvsParse(Box<CvsParseError>),
Expand All @@ -174,8 +174,8 @@ impl From<CvsParseError> for CratesTomlParseError {
}
}

impl From<toml_edit::easy::ser::Error> for CratesTomlParseError {
fn from(e: toml_edit::easy::ser::Error) -> Self {
impl From<toml::ser::Error> for CratesTomlParseError {
fn from(e: toml::ser::Error) -> Self {
CratesTomlParseError::TomlWrite(Box::new(e))
}
}
Expand Down

0 comments on commit 3adc4a2

Please sign in to comment.