Add readme to generated rustlings directory

This can remind users how to use rustlings, in case they come back after
a lengthy break.
This commit is contained in:
Remo Senekowitsch 2026-05-03 14:41:56 +02:00
parent 4f1a440962
commit 5b860864cd
No known key found for this signature in database

View File

@ -165,6 +165,8 @@ pub fn init() -> Result<()> {
fs::write(".gitignore", GITIGNORE)
.context("Failed to create the file `rustlings/.gitignore`")?;
fs::write("README.md", README).context("Failed to create the file `rustlings/README.md`")?;
create_dir(".vscode").context("Failed to create the directory `rustlings/.vscode`")?;
fs::write(".vscode/extensions.json", VS_CODE_EXTENSIONS_JSON)
.context("Failed to create the file `rustlings/.vscode/extensions.json`")?;
@ -220,6 +222,14 @@ target/
.vscode/
";
const README: &[u8] = b"# Rustlings
This is your space to solve Rustlings exercises.
Simply run `rustlings` in this directory to get started!
Learn more about using Rustlings here:
<https://rustlings.rust-lang.org/usage/>
";
pub const VS_CODE_EXTENSIONS_JSON: &[u8] = br#"{"recommendations":["rust-lang.rust-analyzer"]}"#;
const IN_INITIALIZED_DIR_ERR: &str = "It looks like Rustlings is already initialized in this directory.