mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-03 00:43:29 +02:00
Borrow deserialized values
This commit is contained in:
+5
-4
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user