Skip to content

Commit

Permalink
Version bump to 0.22 and fixes for toml_edit (#6179)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfiedotwtf committed Sep 23, 2024
1 parent 3f163c7 commit fd53e45
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ thiserror = "1.0"
tikv-jemallocator = "0.5"
tokio = "1.12"
toml = "0.8"
toml_edit = "0.21"
toml_edit = "0.22"
tower = { version = "0.5", default-features = false }
tower-lsp = "0.20"
tracing = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion forc-plugins/forc-client/src/util/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) fn update_proxy_address_in_manifest(
let mut toml = String::new();
let mut file = File::open(manifest.path())?;
file.read_to_string(&mut toml)?;
let mut manifest_toml = toml.parse::<toml_edit::Document>()?;
let mut manifest_toml = toml.parse::<toml_edit::DocumentMut>()?;
if manifest.proxy().is_some() {
manifest_toml["proxy"]["address"] = toml_edit::value(address);
let mut file = std::fs::OpenOptions::new()
Expand Down
6 changes: 3 additions & 3 deletions forc-plugins/forc-client/tests/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::{
str::FromStr,
};
use tempfile::tempdir;
use toml_edit::{value, Document, InlineTable, Item, Table, Value};
use toml_edit::{value, DocumentMut, InlineTable, Item, Table, Value};

fn get_workspace_root() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
Expand Down Expand Up @@ -75,7 +75,7 @@ fn patch_manifest_file_with_path_std(manifest_dir: &Path) -> anyhow::Result<()>
let toml_path = manifest_dir.join(sway_utils::constants::MANIFEST_FILE_NAME);
let toml_content = fs::read_to_string(&toml_path).unwrap();

let mut doc = toml_content.parse::<Document>().unwrap();
let mut doc = toml_content.parse::<DocumentMut>().unwrap();
let new_std_path = get_workspace_root().join("sway-lib-std");

let mut std_dependency = InlineTable::new();
Expand All @@ -89,7 +89,7 @@ fn patch_manifest_file_with_path_std(manifest_dir: &Path) -> anyhow::Result<()>
fn patch_manifest_file_with_proxy_table(manifest_dir: &Path, proxy: Proxy) -> anyhow::Result<()> {
let toml_path = manifest_dir.join(sway_utils::constants::MANIFEST_FILE_NAME);
let toml_content = fs::read_to_string(&toml_path)?;
let mut doc = toml_content.parse::<Document>()?;
let mut doc = toml_content.parse::<DocumentMut>()?;

let proxy_table = doc.entry("proxy").or_insert(Item::Table(Table::new()));
let proxy_table = proxy_table.as_table_mut().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions forc/src/ops/forc_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn edit_forc_toml(out_dir: &Path, project_name: &str, real_name: &str) -> Result
let mut file = File::open(out_dir.join(constants::MANIFEST_FILE_NAME))?;
let mut toml = String::new();
file.read_to_string(&mut toml)?;
let mut manifest_toml = toml.parse::<toml_edit::Document>()?;
let mut manifest_toml = toml.parse::<toml_edit::DocumentMut>()?;

let mut authors = Vec::new();
let forc_toml: toml::Value = toml::de::from_str(&toml)?;
Expand Down Expand Up @@ -144,7 +144,7 @@ fn edit_cargo_toml(out_dir: &Path, project_name: &str, real_name: &str) -> Resul
}
updated_authors.push(real_name);

let mut manifest_toml = toml.parse::<toml_edit::Document>()?;
let mut manifest_toml = toml.parse::<toml_edit::DocumentMut>()?;
manifest_toml["package"]["authors"] = toml_edit::value(updated_authors);
manifest_toml["package"]["name"] = toml_edit::value(project_name);

Expand Down
2 changes: 1 addition & 1 deletion sway-lsp/src/core/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ pub(crate) fn edit_manifest_dependency_paths(
if let Ok(mut file) = File::open(manifest.path()) {
let mut toml = String::new();
let _ = file.read_to_string(&mut toml);
if let Ok(mut manifest_toml) = toml.parse::<toml_edit::Document>() {
if let Ok(mut manifest_toml) = toml.parse::<toml_edit::DocumentMut>() {
for (name, abs_path) in dependency_map {
manifest_toml["dependencies"][&name]["path"] =
toml_edit::value(abs_path.display().to_string());
Expand Down

0 comments on commit fd53e45

Please # to comment.