Skip to content

Commit

Permalink
upgrade toml dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
syphar committed Jun 23, 2024
1 parent b8556b2 commit 9ba9878
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New method `LogStorage::set_max_line_length` to limit the logged line length when capturing
builds logs

### Changed

- updated `toml` dependency to 0.8.

## [0.16.0] - 2023-05-02

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ flate2 = "1"
tar = "0.4.0"
percent-encoding = "2.1.0"
walkdir = "2.2"
toml = "0.5"
toml = "0.8.12"
fs2 = "0.4.3"
remove_dir_all = "0.7"
base64 = "0.13.0"
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
//! [crater]: https://github.com/rust-lang/crater
//! [docsrs]: https://github.com/rust-lang/docs.rs

#[cfg(test)]
#[macro_use]
extern crate toml;

mod build;
pub mod cmd;
mod crates;
Expand Down
19 changes: 8 additions & 11 deletions src/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ impl<'a> TomlTweaker<'a> {

pub fn save(self, output_file: &Path) -> Result<(), Error> {
let crate_name = self.krate.to_string();
::std::fs::write(output_file, Value::Table(self.table).to_string().as_bytes())?;
::std::fs::write(output_file, toml::to_string(&self.table)?.as_bytes())?;
info!(
"tweaked toml for {} written to {}",
crate_name,
Expand Down Expand Up @@ -393,7 +393,7 @@ mod tests {
use super::TomlTweaker;
use crate::build::{CratePatch, GitCratePatch, PathCratePatch};
use crate::crates::Crate;
use toml::{self, Value};
use toml::toml;

#[test]
fn test_tweak_table_noop() {
Expand All @@ -409,11 +409,10 @@ mod tests {

let krate = Crate::local("/dev/null".as_ref());
let patches: Vec<CratePatch> = Vec::new();
let mut tweaker =
TomlTweaker::new_with_table(&krate, toml.as_table().unwrap().clone(), &patches);
let mut tweaker = TomlTweaker::new_with_table(&krate, toml, &patches);
tweaker.tweak();

assert_eq!(Value::Table(tweaker.table), result);
assert_eq!(tweaker.table, result);
}

#[test]
Expand Down Expand Up @@ -445,11 +444,10 @@ mod tests {

let krate = Crate::local("/dev/null".as_ref());
let patches: Vec<CratePatch> = Vec::new();
let mut tweaker =
TomlTweaker::new_with_table(&krate, toml.as_table().unwrap().clone(), &patches);
let mut tweaker = TomlTweaker::new_with_table(&krate, toml, &patches);
tweaker.tweak();

assert_eq!(Value::Table(tweaker.table), result);
assert_eq!(tweaker.table, result);
}

#[test]
Expand Down Expand Up @@ -504,10 +502,9 @@ mod tests {
path: "/path/to/baz".into(),
}),
];
let mut tweaker =
TomlTweaker::new_with_table(&krate, toml.as_table().unwrap().clone(), &patches);
let mut tweaker = TomlTweaker::new_with_table(&krate, toml, &patches);
tweaker.tweak();

assert_eq!(Value::Table(tweaker.table), result);
assert_eq!(tweaker.table, result);
}
}

0 comments on commit 9ba9878

Please sign in to comment.