summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev/rustlings-repo.txt1
-rw-r--r--src/main.rs9
2 files changed, 10 insertions, 0 deletions
diff --git a/dev/rustlings-repo.txt b/dev/rustlings-repo.txt
new file mode 100644
index 0000000..6279361
--- /dev/null
+++ b/dev/rustlings-repo.txt
@@ -0,0 +1 @@
+This file is used to check if the user tries to run Rustlings in the repository (the method before v6)
diff --git a/src/main.rs b/src/main.rs
index 69ac0a3..bf2498a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -75,6 +75,10 @@ enum Subcommands {
fn main() -> Result<()> {
let args = Args::parse();
+ if !DEBUG_PROFILE && Path::new("dev/rustlings-repo.txt").exists() {
+ bail!("{OLD_METHOD_ERR}");
+ }
+
which::which("cargo").context(CARGO_NOT_FOUND_ERR)?;
match args.command {
@@ -174,6 +178,11 @@ fn main() -> Result<()> {
Ok(())
}
+const OLD_METHOD_ERR: &str = "You are trying to run Rustlings using the old method before v6.
+The new method doesn't include cloning the Rustlings' repository.
+Please follow the instructions in the README:
+https://github.com/rust-lang/rustlings#getting-started";
+
const CARGO_NOT_FOUND_ERR: &str = "Failed to find `cargo`.
Did you already install Rust?
Try running `cargo --version` to diagnose the problem.";