Document -> DocumentMut

This commit is contained in:
Gwilym Inzani 2024-03-20 13:26:02 +00:00
parent 33bc38a094
commit b28f3872c0
2 changed files with 5 additions and 5 deletions

View file

@ -5,7 +5,7 @@ use std::collections::HashMap;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
use toml_edit::Document;
use toml_edit::DocumentMut;
use crate::utils::*;
@ -149,10 +149,10 @@ fn get_agb_dependencies(folder: &Path) -> Result<Vec<String>, Error> {
Ok(result)
}
fn read_cargo_toml(folder: &Path) -> Result<Document, Error> {
fn read_cargo_toml(folder: &Path) -> Result<DocumentMut, Error> {
let cargo_toml_contents =
fs::read_to_string(folder.join("Cargo.toml")).map_err(|_| Error::CargoToml)?;
let cargo_toml: Document = cargo_toml_contents.parse().map_err(|_| Error::CargoToml)?;
let cargo_toml: DocumentMut = cargo_toml_contents.parse().map_err(|_| Error::CargoToml)?;
Ok(cargo_toml)
}

View file

@ -98,7 +98,7 @@ fn update_to_version(
let toml_file_content = std::fs::read_to_string(toml_file).map_err(|_| Error::ReadTomlFile)?;
let mut cargo_toml = toml_file_content
.parse::<toml_edit::Document>()
.parse::<toml_edit::DocumentMut>()
.map_err(|_| Error::InvalidToml(toml_file.to_string_lossy().into_owned()))?;
let new_version = format!("{new_version}");
@ -120,7 +120,7 @@ fn update_to_version(
let toml_file_content =
std::fs::read_to_string(&cargo_toml_file).map_err(|_| Error::ReadTomlFile)?;
let mut cargo_toml = toml_file_content
.parse::<toml_edit::Document>()
.parse::<toml_edit::DocumentMut>()
.map_err(|_| Error::InvalidToml(cargo_toml_file.to_string_lossy().into_owned()))?;
if let Some(this_dep) = cargo_toml["dependencies"].get_mut(&project_name) {