From aba47a5c96b94c9ebe1b6ebdb641f9b0b551ac41 Mon Sep 17 00:00:00 2001 From: Jack Clayton Date: Thu, 13 Jan 2022 20:15:06 +0800 Subject: [PATCH] Remove default run --- Cargo.toml | 1 - src/fix_rust_analyzer.rs | 18 +++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6fa38c74..66dcd8e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,6 @@ name = "rustlings" version = "4.6.0" authors = ["anastasie ", "Carol (Nichols || Goulding) "] edition = "2021" -default-run = "rustlings" [dependencies] argh = "0.1.4" diff --git a/src/fix_rust_analyzer.rs b/src/fix_rust_analyzer.rs index 33eadb82..f0894179 100644 --- a/src/fix_rust_analyzer.rs +++ b/src/fix_rust_analyzer.rs @@ -32,6 +32,15 @@ impl RustAnalyzerProject { } } + /// Write rust-project.json to disk + pub fn write_to_disk(&self) -> Result<(), std::io::Error> { + std::fs::write( + "./rust-project.json", + serde_json::to_vec(&self).expect("Failed to serialize to JSON"), + )?; + Ok(()) + } + /// If path contains .rs extension, add a crate to `rust-project.json` fn path_to_json(&mut self, path: String) { if let Some((_, ext)) = path.split_once(".") { @@ -45,15 +54,6 @@ impl RustAnalyzerProject { } } - /// Write rust-project.json to disk - pub fn write_to_disk(&self) -> Result<(), std::io::Error> { - std::fs::write( - "./rust-project.json", - serde_json::to_vec(&self).expect("Failed to serialize to JSON"), - )?; - Ok(()) - } - /// Parse the exercises folder for .rs files, any matches will create /// a new `crate` in rust-project.json which allows rust-analyzer to /// treat it like a normal binary