Borrow deserialized values

This commit is contained in:
mo8it
2026-02-26 16:10:09 +01:00
parent 13564207cb
commit 0cbcb8964c
10 changed files with 57 additions and 54 deletions
+5 -4
View File
@@ -8,7 +8,7 @@ use std::{
env::set_current_dir,
fs::{self, create_dir},
io::{self, Write},
path::{Path, PathBuf},
path::Path,
process::{Command, Stdio},
};
@@ -18,8 +18,9 @@ use crate::{
};
#[derive(Deserialize)]
struct CargoLocateProject {
root: PathBuf,
struct CargoLocateProject<'a> {
#[serde(borrow)]
root: &'a Path,
}
pub fn init() -> Result<()> {
@@ -72,7 +73,7 @@ pub fn init() -> Result<()> {
)?
.root;
let workspace_manifest_content = fs::read_to_string(&workspace_manifest)
let workspace_manifest_content = fs::read_to_string(workspace_manifest)
.with_context(|| format!("Failed to read the file {}", workspace_manifest.display()))?;
if !workspace_manifest_content.contains("[workspace]")
&& !workspace_manifest_content.contains("workspace.")