From e73fff3bd4d6c55a2b741415ef02b9e945ef3b42 Mon Sep 17 00:00:00 2001 From: mo8it Date: Fri, 16 May 2025 11:08:25 +0200 Subject: [PATCH] Add dev alias --- .cargo/config.toml | 2 ++ dev/Cargo.toml | 2 +- src/dev/check.rs | 4 ++-- src/dev/update.rs | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..b8fa3f77 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +dev = ["run", "--", "dev"] diff --git a/dev/Cargo.toml b/dev/Cargo.toml index ae380d17..4f725b70 100644 --- a/dev/Cargo.toml +++ b/dev/Cargo.toml @@ -1,4 +1,4 @@ -# Don't edit the `bin` list manually! It is updated by `cargo run -- dev update`. This comment line will be stripped in `rustlings init`. +# Don't edit the `bin` list manually! It is updated by `cargo dev update`. This comment line will be stripped in `rustlings init`. bin = [ { name = "intro1", path = "../exercises/00_intro/intro1.rs" }, { name = "intro1_sol", path = "../solutions/00_intro/intro1.rs" }, diff --git a/src/dev/check.rs b/src/dev/check.rs index c89c4eb2..9cde7f24 100644 --- a/src/dev/check.rs +++ b/src/dev/check.rs @@ -43,7 +43,7 @@ fn check_cargo_toml( if old_bins != new_bins { if cfg!(debug_assertions) { bail!( - "The file `dev/Cargo.toml` is outdated. Run `cargo run -- dev update` to update it. Then run `cargo run -- dev check` again" + "The file `dev/Cargo.toml` is outdated. Run `cargo dev update` to update it. Then run `cargo run -- dev check` again" ); } @@ -379,7 +379,7 @@ pub fn check(require_solutions: bool) -> Result<()> { } if cfg!(debug_assertions) { - // A hack to make `cargo run -- dev check` work when developing Rustlings. + // A hack to make `cargo dev check` work when developing Rustlings. check_cargo_toml(&info_file.exercises, "dev/Cargo.toml", b"../")?; } else { check_cargo_toml(&info_file.exercises, "Cargo.toml", b"")?; diff --git a/src/dev/update.rs b/src/dev/update.rs index 6de3c8f7..e0855a0e 100644 --- a/src/dev/update.rs +++ b/src/dev/update.rs @@ -28,7 +28,7 @@ pub fn update() -> Result<()> { let info_file = InfoFile::parse()?; if cfg!(debug_assertions) { - // A hack to make `cargo run -- dev update` work when developing Rustlings. + // A hack to make `cargo dev update` work when developing Rustlings. update_cargo_toml(&info_file.exercises, "dev/Cargo.toml", b"../") .context("Failed to update the file `dev/Cargo.toml`")?;