mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Document -> DocumentMut
This commit is contained in:
parent
33bc38a094
commit
b28f3872c0
|
@ -5,7 +5,7 @@ use std::collections::HashMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use toml_edit::Document;
|
use toml_edit::DocumentMut;
|
||||||
|
|
||||||
use crate::utils::*;
|
use crate::utils::*;
|
||||||
|
|
||||||
|
@ -149,10 +149,10 @@ fn get_agb_dependencies(folder: &Path) -> Result<Vec<String>, Error> {
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_cargo_toml(folder: &Path) -> Result<Document, Error> {
|
fn read_cargo_toml(folder: &Path) -> Result<DocumentMut, Error> {
|
||||||
let cargo_toml_contents =
|
let cargo_toml_contents =
|
||||||
fs::read_to_string(folder.join("Cargo.toml")).map_err(|_| Error::CargoToml)?;
|
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)
|
Ok(cargo_toml)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ fn update_to_version(
|
||||||
|
|
||||||
let toml_file_content = std::fs::read_to_string(toml_file).map_err(|_| Error::ReadTomlFile)?;
|
let toml_file_content = std::fs::read_to_string(toml_file).map_err(|_| Error::ReadTomlFile)?;
|
||||||
let mut cargo_toml = toml_file_content
|
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()))?;
|
.map_err(|_| Error::InvalidToml(toml_file.to_string_lossy().into_owned()))?;
|
||||||
|
|
||||||
let new_version = format!("{new_version}");
|
let new_version = format!("{new_version}");
|
||||||
|
@ -120,7 +120,7 @@ fn update_to_version(
|
||||||
let toml_file_content =
|
let toml_file_content =
|
||||||
std::fs::read_to_string(&cargo_toml_file).map_err(|_| Error::ReadTomlFile)?;
|
std::fs::read_to_string(&cargo_toml_file).map_err(|_| Error::ReadTomlFile)?;
|
||||||
let mut cargo_toml = toml_file_content
|
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()))?;
|
.map_err(|_| Error::InvalidToml(cargo_toml_file.to_string_lossy().into_owned()))?;
|
||||||
|
|
||||||
if let Some(this_dep) = cargo_toml["dependencies"].get_mut(&project_name) {
|
if let Some(this_dep) = cargo_toml["dependencies"].get_mut(&project_name) {
|
||||||
|
|
Loading…
Reference in a new issue