mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-11-08 09:09:17 +01:00
Catch the usage of the old method
This commit is contained in:
parent
04d36996dd
commit
49e4a1fab0
1
dev/rustlings-repo.txt
Normal file
1
dev/rustlings-repo.txt
Normal file
@ -0,0 +1 @@
|
||||
This file is used to check if the user tries to run Rustlings in the repository (the method before v6)
|
@ -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.";
|
||||
|
Loading…
Reference in New Issue
Block a user