mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 00:00:03 +03:00
Add README to the solutions dir
This commit is contained in:
parent
97719fe8da
commit
693bb708b2
|
@ -13,6 +13,7 @@ cargo install rustlings
|
||||||
- Fix `rust-analyzer` rebuilding all exercises after changing one file.
|
- Fix `rust-analyzer` rebuilding all exercises after changing one file.
|
||||||
- Show a helpful error message when trying to install Rustlings with a Rust version lower than the minimum one that Rustlings supports.
|
- Show a helpful error message when trying to install Rustlings with a Rust version lower than the minimum one that Rustlings supports.
|
||||||
- Remove the state file and the solutions directory from the generated `.gitignore` file.
|
- Remove the state file and the solutions directory from the generated `.gitignore` file.
|
||||||
|
- Add a `README.md` file to the `solutions/` directory.
|
||||||
- Run the final check of all exercises in parallel.
|
- Run the final check of all exercises in parallel.
|
||||||
- Small exercise improvements.
|
- Small exercise improvements.
|
||||||
- `dev check`: Check that all solutions are formatted with `rustfmt`.
|
- `dev check`: Check that all solutions are formatted with `rustfmt`.
|
||||||
|
|
6
solutions/README.md
Normal file
6
solutions/README.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Official Rustlings solutions
|
||||||
|
|
||||||
|
Before you finish an exercise, its solution file will only contain an empty `main` function.
|
||||||
|
The content of this file will be automatically replaced by the actual solution once you finish the exercise.
|
||||||
|
|
||||||
|
Note that these solution are often only _one possibility_ to solve an exercise.
|
|
@ -35,6 +35,11 @@ pub fn init() -> Result<()> {
|
||||||
.context("Failed to initialize the `rustlings/exercises` directory")?;
|
.context("Failed to initialize the `rustlings/exercises` directory")?;
|
||||||
|
|
||||||
create_dir("solutions").context("Failed to create the `solutions/` directory")?;
|
create_dir("solutions").context("Failed to create the `solutions/` directory")?;
|
||||||
|
fs::write(
|
||||||
|
"solutions/README.md",
|
||||||
|
include_bytes!("../solutions/README.md"),
|
||||||
|
)
|
||||||
|
.context("Failed to create the file rustlings/solutions/README.md")?;
|
||||||
for dir in EMBEDDED_FILES.exercise_dirs {
|
for dir in EMBEDDED_FILES.exercise_dirs {
|
||||||
let mut dir_path = String::with_capacity(10 + dir.name.len());
|
let mut dir_path = String::with_capacity(10 + dir.name.len());
|
||||||
dir_path.push_str("solutions/");
|
dir_path.push_str("solutions/");
|
||||||
|
|
Loading…
Reference in a new issue