- Show a helpful error message when trying to install Rustlings with a Rust version lower than the minimum one that Rustlings supports.
- Run the final check of all exercises in parallel.
- Small exercise improvements.
dev check
: Check that all solutions are formatted withrustfmt
.
dev check
: Check that all exercises (including third-party ones) include at least oneTODO
comment.dev check
: Check that all exercises actually fail to run (not already solved).
- Make enum variants more consistent between enum exercises.
iterators3
: Teach about the possible case of integer overflow during division.
- Exit with a helpful error message on missing/unsupported terminal/TTY.
- Mark the last exercise as done.
Small exercise improvements and fixes.
Most importantly, fixed that the exercise clippy1
was already solved 😅
This release is the result of a complete rewrite to deliver a ton of new features and improvements ✨ The most important changes are highlighted below.
The installation has been simplified a lot! To install Rustlings after installing Rust, all what you need to do now is running the following command:
cargo install rustlings
Yes, this means that Rustlings is now on crates.io 🎉
You can read about the motivations of this change in this issue.
- The UI is now responsive when the terminal is resized.
- The progress bar was moved to the bottom so that you can always see your progress and the current exercise to work on.
- The current exercise path is now a terminal link. It will open the exercise file in your default editor when you click on it.
- A small prompt is now always shown at the bottom. It allows you to choose an action by entering a character. For example, entering
h
will show you the hint of the current exercise. - The comment "I AM NOT DONE!" doesn't exist anymore. Instead of needing to remove it to go to the next exercise, you need to enter
n
in the terminal.
A list mode was added using Ratatui.
You can enter it by entering l
in the watch mode.
It offers the following features:
- Browse all exercises and see their state (pending/done).
- Filter exercises based on their state (pending/done).
- Continue at another exercise. This allows you to skip some exercises or go back to previous ones.
- Reset an exercise so you can start over and revert your changes.
After finishing an exercise, a solution file will be available and Rustlings will show you its path in green. This allows you to compare your solution with an idiomatic solution and maybe learn about other ways to solve a problem.
While writing the solutions, all exercises have been polished 🌟
For example, every exercise now contains TODO
comments to highlight what the user needs to change and where.
Instead of creating a project.json
file using rustlings lsp
, Rustlings now works with a Cargo.toml
file out of the box.
No actions are needed to activate the language server rust-analyzer
.
This should avoid issues related to the language server or to running exercises, especially the ones with Clippy.
Clippy lints are now shown on all exercises, not only the Clippy exercises 📎 Make Clippy your friend from early on 🥰
Rustlings now supports third-party exercises!
Do you want to create your own set of Rustlings exercises to focus on some specific topic? Or do you want to translate the original Rustlings exercises? Then follow the link to the guide about third-party exercises!
- Converted all exercises with assertions to test mode.
cow1
: Reverted regression introduced by callingto_mut
where it shouldn't have been called, and clarified comment.primitive_types3
: Require at least an array of 100 elements.- Removed hint comments when no hint exists for the exercise.
as_ref_mut
: Fixed a typo in a test function name.enums3
: Fixed formatting withrustfmt
.
- New exercise:
if3
, teaching the user aboutif let
statements. hashmaps2
: Added an extra test function to check if the amount of fruits is higher than zero.enums3
: Added a test forMessage
.if1
: Added a test case to check equal values.if3
: Added a note specifying that there are no test changes needed.
- Swapped the order of threads and smart pointer exercises.
- Rewrote the CLI to use
clap
- it's matured much since we switched toargh
:) structs3
: Switched from i32 to u32.move_semantics
: Switched 1-4 to tests, and rewrote them to be way simpler, while still teaching about the same concepts.
iterators5
:- Removed an outdated part of the hint.
- Renamed variables to use snake_case.
vecs2
: Updated the hint to reference the renamed loop variable.enums3
: Changed message string in test so that it gets properly tested.strings2
: Corrected line number in hint, then removed it (this both happened as part of this release cycle).primitive_types4
: Updated hint to the correct ending index.quiz1
: Removed duplicated sentence from exercise comments.errors4
: Improved comment.from_into
: Fixed test values.cow1
: Added.to_mut()
to distinguish from the previous test case.threads2
: Updated hint text to reference the correct book heading.
- Cleaned up the explanation paragraphs at the start of each exercise.
- Lots of Nix housekeeping that I don't feel qualified to write about!
- Improved CI workflows, we're now testing on multiple platforms at once.
- Reverted
rust-project.json
path generation due to an upstreamrust-analyzer
fix.
strings2
: Added a reference to the book chapter for reference conversionlifetimes
: Added a link to the lifetimekata project- Added a new
tests4
exercises, which teaches about testing for panics - Added a
!
prefix command to watch mode that runs an external command - Added a
--success-hints
option to watch mode that shows hints on exercise success
vecs2
: Renamed iterator variable bindings for clarifylifetimes
: Changed order of book referenceshashmaps2
: Clarified instructions in the todo block- Moved lifetime exercises before test exercises (via the recommended book ordering)
options2
: Improved tests for layering optionsmodules2
: Added more information to the hint
errors2
: Corrected a comment wordingiterators2
: Fixed a spelling mistake in the hint textvariables
: Wrapped the mut keyword with backticks for readabilitymove_semantics2
: Removed references to line numberscow1
: Clarified theowned_no_mutation
commentsoptions3
: Changed exercise to panic when no match is foundrustlings lsp
now generates absolute paths, which should fix VSCoderust-analyzer
usage on Windows
- Added a markdown linter to run on GitHub actions
- Split quick installation section into two code blocks
vecs
: Added links toiter_mut
andmap
to README.mdcow1
: Changed main to testsiterators1
: Formatted according to rustfmt
errors5
: Unified undisclosed type notationarc1
: Improved readability by avoiding implicit dereferencemacros4
: Prevented auto-fix by adding#[rustfmt::skip]
cli
: Actually show correct progress percentages
- Reordered exercises
- Unwrapped
standard_library_types
intoiterators
andsmart_pointers
- Moved smart pointer exercises behind threads
- Ordered
rc1
beforearc1
- Unwrapped
- intro1: Added a note on
rustlings lsp
- threads1: Panic if threads are not joined
- cli:
- Made progress bar update proportional to amount of files verified
- Decreased
watch
delay from 2 to 1 second
- Capitalized "Rust" in exercise hints
- enums3: Removed superfluous tuple brackets
- quiz2, clippy1, iterators1: Fixed a typo
- rc1: Fixed a prompt error
- cli:
- Fixed a typo in a method name
- Specified the edition in
rustc
commands
- Bumped min Rust version to 1.58 in installation script
- cli: Added a percentage display in watch mode
- Added a
flake.nix
for Nix users
- structs3: Added an additional test
- macros: Added a link to MacroKata in the README
- strings3: Added a link to
std
in the hint - threads1: Corrected a hint link
- iterators1: Clarified hint steps
- errors5: Fix a typo in the hint
- options1: Clarified on the usage of the 24-hour system
- threads2, threads3: Explicitly use
Arc::clone
- structs3: Clarifed the hint
- quiz2, as_ref_mut, options1, traits1, traits2: Clarified hints
- traits1, traits2, cli: Tidied up unmatching backticks
- enums2: Removed unnecessary indirection of self
- enums3: Added an extra tuple comment
- Added a VSCode extension recommendation
- Applied some Clippy and rustfmt formatting
- Added a note on Windows PowerShell and other shell compatibility
- quiz1: Reworded the comment to actually reflect what's going on in the tests. Also added another assert just to make sure.
- rc1: Fixed a typo in the hint.
- lifetimes: Add quotes to the
println!
output, for readability.
- Fixed a typo in README.md
- Added a
reset
command
- options2: Convert the exercise to use tests
- threads3: Fixed a typo
- quiz1: Adjusted the explanations to be consistent with the tests
- Fixed an incorrect assertion in options1
- Added a new
rc1
exercise. - Added a new
cow1
exercise.
- variables5: Corrected reference to previous exercise
- functions4: Fixed line number reference
- strings3: Clarified comment wording
- traits4, traits5: Fixed line number reference
- traits5:
- Fixed typo in "parameter"
- Made exercise prefer a traits-based solution
- lifetimes2: Improved hint
- threads3: Fixed typo in hint
- box1: Replaced
unimplemented!
withtodo!
- errors5: Provided an explanation for usage of
Box<dyn Error>
- quiz2: Fixed a typo
- macros: Updated the macros book link
- options1:
- Removed unused code
- Added more granular tests
- Fixed some comment syntax shenanigans in info.toml
- Fixed a typo in .editorconfig
- Fixed a typo in integration_tests.rs
- Clarified manual installation instructions using
cargo install --path .
- Added a link to our Zulip in the readme file
- Hint comments in exercises now also include a reference to the
hint
watch mode subcommand. - intro1: Added more hints to point the user to the source file.
- variables: Switched variables3 and variables4.
- Moved
vec
andprimitive_types
exercises beforemove_semantics
. - Renamed
vec
tovecs
to be more in line with the naming in general. - Split up the
collections
exercises in their own folders. - vec2: Added a second part of the function that provides an alternative, immutable way of modifying vec values.
- enums3: Added a hint.
- Moved
strings
beforemodules
. - Added a
strings3
exercise to teach modifying strings. - Added a
hashmaps3
exercise for some advanced usage of hashmaps. - Moved the original
quiz2
to bestrings4
, since it only tested strings anyways. - Reworked
quiz2
into a new exercise that tests more chapters. - Renamed
option
tooptions
. - options1: Rewrote parts of the exercise to remove the weird array iteration stuff.
- Moved
generics3
to bequiz3
. - Moved box/arc exercises behind
iterators
. - iterators4: Added a test for factorials of zero.
- Split
threads1
between two exercises, the first one focusing more onJoinHandle
s. - Added a
threads3
exercises that usesstd::sync::mpsc
. - Added a
clippy3
exercises with some more interesting checks. - as_ref_mut: Added a section that actually tests
AsMut
. - Added 3 new lifetimes exercises.
- Added 3 new traits exercises.
- variables2: Made output messages more verbose.
- variables5: Added a nudging hint about shadowing.
- variables6: Fixed link to book.
- functions: Clarified the README wording. Generally cleaned up some hints and added some extra comments.
- if2: Renamed function name to
foo_if_fizz
. - move_semantics: Clarified some hints.
- quiz1: Renamed the function name to be more verbose.
- structs1: Use an integer type instead of strings. Renamed "unit structs" to "unit-like structs", as is used in the book.
- structs3: Added the
panic!
statement in from the beginning. - errors1: Use
is_empty()
instead oflen() > 0
- errors3: Improved the hint.
- errors5: Improved exercise instructions and the hint.
- errors6: Provided the skeleton of one of the functions that's supposed to be implemented.
- iterators3: Inserted
todo!
intodivide()
to keep a compiler error from happening. - from_str: Added a hint comment about string error message conversion with
Box<dyn Error>
. - try_from_into: Fixed the function name in comment.
- Removed the legacy LSP feature that was using
mod.rs
files. - Removed
quiz4
. - Removed
advanced_errs
. These were the last exercises in the recommended order, and I've always felt like they didn't quite fit in with the mostly simple, book-following style we've had in Rustlings.
- Added missing exercises to the book index.
- Updated spacing in Cargo.toml.
- Added a GitHub actions config so that tests run on every PR/commit.
- Added a progress indicator for
rustlings watch
. - The installation script now checks for Rustup being installed.
- Added a
rustlings lsp
command to enablerust-analyzer
.
- move_semantics5: Replaced "in vogue" with "in scope" in hint.
- if2: Fixed a typo in the hint.
- variables1: Fixed an incorrect line reference in the hint.
- Fixed an out of bounds check in the installation Bash script.
- Replaced the git.io URL with the fully qualified URL because of git.io's sunsetting.
- Removed the deprecated Rust GitPod extension.
- The amount of dependency crates that need to be compiled went down from ~65 to ~45 by bumping dependency versions.
- The minimum Rust version in the install scripts has been bumped to 1.56.0 (this isn't in the release itself, since install scripts don't really get versioned)
- arc1: A small part has been rewritten using a more functional code style (#968).
- using_as: A small part has been refactored to use
sum
instead offold
, resulting in better readability.
- The changelog will now be manually written instead of being automatically generated by the Git log.
- Add move_semantics6.rs exercise (#908) (3f0e1303)
- intro: Add intro section. (21c9f441)
- Include exercises folder in the project structure behind a feature, enabling rust-analyzer to work (#917) (179a75a6)
- Fix a few spelling mistakes (1c0fe3cb)
- cli:
- clippy1:
- errors1:
- errors6: Remove existing answer code (43d0623)
- functions5: Remove wrong new line and small English improvements (#885) (8ef4869b)
- install: protect path with whitespaces using quotes and stop at the first error (d114847f)
- intro1: Add compiler error explanation. (9b8de655)
- iterators1: reorder TODO steps (0bd7a063)
- move_semantics2: Add comment (89650f80)
- move_semantics5: correct typo (#857) (46c28d5c)
- quiz1: update to say quiz covers "If" (1622e8c1)
- structs3:
- structs3.rs: assigned value to cents_per_gram in test (d1ee2daf)
- traits1: rename test functions to snake case (#854) (1663a16e)
- Add hints on how to get GCC installed (#741) (bc56861)
- Fix some code blocks that were not highlighted (17f9d74)
- add advanced_errs2 (abd6b70c)
- add advanced_errs1 (882d535b)
- Add a farewell message when quitting
watch
(1caef0b4) - add more watch commands (a7dc080b, closes #842)
- modules: update exercises, add modules3 (#822) (dfd2fab4)
- quiz1: add default function name in comment (#838) (0a11bad7)
- Correct small typo in exercises/conversions/from_str.rs (86cc8529)
- cli: typo in exercise.rs (#848) (06d5c097)
- from_str, try_from_into: custom error types (2dc93cad)
- modules2: fix typo (#835) (1c3beb0a)
- move_semantics5:
- quiz1: Fix inconsistent wording (#826) (03131a3d)
- Add move_semantics5 exercise. (#746) (399ab328)
- cli: Add "next" to run the next unsolved exercise. (#785) (d20e413a)
- rename result1 to errors4 (50ab289d)
- move_semantics5 hints (1b858285)
- remove trailing whitespaces from iterators1 (4d4fa774)
- add hints to generics1 and generics2 exercises (31457940)
- remove trailing whitespace (d9b69bd1)
- installation: first PowerShell command (aa9a943d)
- iterators5: derive Clone, Copy (91fc9e31)
- quiz1: Updated question description (#794) (d8766496)
- try_from_into, from_str: hints for dyn Error (11d2cf0d)
- variables5: confine the answer further (48ffcbd2)
- Fix spelling error in main.rs (91ee27f2)
- typo in default out text (644c49f1)
- collections: Naming exercises for vectors and hashmap (bef39b12)
- from_str:
- functions3: improve function argument type (#687) (a6509cc4)
- hashmap2: Update incorrect assertion (#660) (72aaa15e)
- info: Fix typo (#635) (cddc1e86)
- iterators2: Moved errors out of tests. (baf4ba17, closes #359)
- iterators3: Enabled iterators3.rs to run without commented out tests. (c6712dfc)
- main: Let find_exercise work with borrows (347f30bd)
- move_semantics4:
- option2: Rename uninformative variables (#675) (b4de6594)
- quiz3: Force an answer to Q2 (#672) (0d894e6f)
- structs: Add 5.3 to structs/README (#652) (6bd791f2)
- structs2: correct grammar in hint (#663) (ebdb66c7)
- structs3:
- threads1: line number correction (7857b0a6)
- try_from_into: use trait objects (2e93a588)
- Replace clap with argh (7928122f)
- Replace emojis when NO_EMOJI env variable present (8d62a996)
- Added iterators5.rs exercise. (b29ea17e)
- arc1: Add more details to description and hint (#710) (81be4044)
- cli: Improve the list command with options, and then some (8bbe4ff1)
- list:
- Rewrite default out text (44d39112)
- match exercise order to book chapters (#541) (033bf119)
- Crab? (#586) (fa9f522b)
- add "rustlings list" command (838f9f30)
- try_from_into: remove duplicate annotation (04f1d079)
- update structs README (bcf14cf6)
- added missing exercises to info.toml (90cfb6ff)
- gives a bit more context to magic number (30644c9a)
- functions2: Change signature to trigger precise error message: (#605) (0ef95947)
- structs1: Adjust wording (#573) (9334783d)
- try_from_into:
- vec1: Have test compare every element in a and v (9b6c6293)
- Add HashMap exercises (633c00cf)
- Add Vec exercises (0c12fa31)
- primitive_types6: Add a test (#548) (2b1fb2b7)
- try_from_into: Add tests (#571) (95ccd926)
- log error output when inotify limit is exceeded (d61b4e5a)
- more unique temp_file (5643ef05)
- installation: Update the MinRustVersion (21bfb2d4)
- iterators2: Update description (#578) (197d3a3d)
- primitive_types6:
- quiz3: Second test is for odd numbers, not even. (#553) (18e0bfef)
- Update rustlings version in Cargo.lock (1cc40bc9)
- arc1: index mod should equal thread count (b4062ef6)
- enums3: Update Message::ChangeColor to take a tuple. (#457) (4b6540c7)
- exercises: adding question mark to quiz2 (101072ab)
- generics3: clarify grade change (47f7672c)
- structs3: Small adjustment of variable name (114b54cb)
- using_as: Add test so that proper type is returned. (#512) (3286c5ec)
- Added iterators1.rs exercise (9642f5a3)
- Add ability to run rustlings on repl.it (#471) (8f7b5bd0)
- Add gitpod support (#473) (4821a8be)
- Remind the user of the hint option (#425) (816b1f5e)
- Remind the user of the hint option (#425) (9f61db5d)
- cli: Added 'cls' command to 'watch' mode (#474) (4f2468e1)
- try_from_into: Add insufficient length test (#469) (523d18b8)
- Add a --nocapture option to display test harnesses' outputs (8ad5f9bf)
- Rename test to quiz, fixes #244 (010a0456)
- Add traits README (173bb141)
- Add box1.rs exercise (7479a473)
- Rewrite try_from_into (#393) (763aa6e3)
- Add if2 exercise (1da84b5f)
- Added exercise structs3.rs (b66e2e09)
- Add exercise variables6 covering const (#352) (5999acd2)
- Change then to than (ddd98ad7)
- rename quiz1 to tests1 in info (#420) (0dd1c6ca)
- fix quiz naming inconsistency (#421) (5563adbb)
- confine the user further in variable exercises (06ef4cc6)
- update iterator and macro text for typos and clarity (95900828)
- update generics2 closes #362 (964c974a)
- confusing comment in conversions/try_from_into.rs (c9e4f2cf)
- arc1: Passively introduce attributes (#429) (113cdae2)
- box1: fix comment typo (#426) (bb2ca251)
- errorsn: Try harder to confine the user. (#388) (2b20c8a0)
- from_into.rs: typo (a901499e)
- generics2: Guide students to the answer (#430) (e6bd8021)
- installation:
- option1:
- option2: Add TODO to comments (#400) (10967bce)
- options1: Add hint about Array Initialization (#389) (9f75554f)
- test2: name of type String and &str (#394) (d6c0a688)
- variables6: minor typo (#419) (524e17df)
- make "compile" exercises print output (#278) (3b6d5c)
- primitive_types: revert primitive_types4 (#296) (b3a3351e)
- run: compile clippy exercise files (#295) (3ab084a4)
- conversions:
- don't hardcode documentation version for traits (#288) (30e6af)
- add Option2 exercise (#290) (86b5c08b)
- add exercise for option (#282) (135e5d47)
- add new exercises for generics (#280) (76be5e4e)
- ci: add buildkite config (b049fa2c)
- Re-add cloning the repo to install scripts (3d9b03c5)
- Add clippy lints (#269) (1e2fd9c9)
- Update deps to version compatable with aarch64-pc-windows (#263) (19a93428)
- docs:
- installation: make fatal errors more obvious (#272) (17d0951e)
- iterators2:
- Remove reference to missing iterators2.rs (#245) (419f7797)
- as_ref_mut: Enable a test and improve per clippy's suggestion (#256) (dfdf809)
- tests1:
- Add variables5.rs exercise (#264) (0c73609e)
- Show a completion message when watching (#253) (d25ee55a)
- Add type conversion and parsing exercises (#249) (0c85dc11)
- Created consistent money unit (#258) (fd57f8f)
- Enable test for exercise test4 (#276) (8b971ff)
- Added traits exercises (#274 but specifically #216, which originally added this ❤️) (b559cdd)
- add line numbers in several exercises and hints (b565c4d3)
- arc1: Fix some words in the comment (c42c3b21)
- enums: Add link to chapter on pattern syntax (#242) (615ce327)
- primitive_types4:
- strings2: update line number in hint (a09f684f)
- variables1: Correct wrong word in comment (fda5a470)
- watch: show hint while watching (8143d57b)
- default: Clarify the installation procedure (c371b853)
- info: Fix trailing newlines for hints (795b6e34)
- run: make
run
never prompt (4b265465)
- Refactor hint system (9bdb0a12)
- improve
watch
execution mode (2cdd6129) - Index exercises by name (627cdc07)
- run: makes
run
never prompt (4b265465)
- errors3: Update hint (dcfb427b, closes #185)
- if1: Remove
return
reference (ad03d180) - strings: Move Strings before Structs (6dcecb38, closes #204)
- structs1: Remove misleading comment (f72e5a8f)
- threads: Move Threads behind SLT (fbe91a67, closes #205)
- watch: clear screen before each
verify()
(3aff590)
- test1: Rewrite logic (79a56942)
- installation: Fix rustlings installation check (7a252c47)
- iterators: Rename iterator3.rs (433d2115)
- iterators2: Remove syntax resulting in misleading error message (4cde8664)
- option1:
- primitive_types4: Fail on a slice covering the wrong area (5b1e673c)
- readme: http to https (70946b85)
- test1:
- Add enums exercises (dc150321)
- Added exercise for struct update syntax (1c4c8764)
- iterators2: adds iterators2 exercise including config (9288fccf)
- iterators2: Remove syntax resulting in misleading error message (4cde8664)
- option1: Add test for prematurely passing exercise (a750e4a1)
- test1: Swap assertion parameter order (4086d463)
- installation: Fix rustlings installation check (7a252c47)
- iterators: Rename iterator3.rs (433d2115)
- readme: http to https (70946b85)
- test1: renamed function name to snake case (89d5186c)
- cli: Check if changed exercise file exists before calling verify (ba85ca3)
- structs1: Fix the irrefutable let pattern warning (cc6a141)
- changelog: Use clog for changelogs (34e31232)
- iterators2: adds iterators2 exercise including config (9288fccf)
- Adds a simple exercise for structures (#163, @briankung)
- Add Result type signature as it is difficult for new comers to understand Generics and Error all at once. (#157, @veggiemonk)
- Rustfmt and whitespace fixes (#161, @eddyp)
- errorsn.rs: Separate also the hints from each other to avoid accidental viewing (#162, @eddyp)
- fixed outdated links (#165, @gushroom)
- Fix broken link (#164, @HanKruiger)
- Remove highlighting and syntect (#167, @komaeda)
- Reverted
--nocapture
flag since it was causing tests to pass unconditionally
- Fix the
--nocapture
feature (@komaeda) - Provide a nicer error message for when you're in the wrong directory
- Add errors to exercises that compile without user changes (@yvan-sraka)
- Use --nocapture when testing, enabling
println!
when running (@komaeda)
- Fix permissions on exercise files (@zacanger, #133)
- Make installation checks more thorough (@komaeda, 1b3469f236bc6979c27f6e1a04e4138a88e55de3)
- Fix order of true/false in tests for executables (@mgeier, #137)
- Stop run from panicking when compile fails (@cjpearce, #141)
- Fix intermittent test failure caused by race condition (@cjpearce, #140)
- Fix links by deleting book version (@diodfr, #142)
- Canonicalize paths to fix path matching (@cjpearce, #143)
- errors2.rs: update link to Rust book (#124)
- Start verification at most recently modified file (#120)
- Watch for file creation events in watch mode (#117)
- Add standard library types to exercises suite (#119)
- Give a warning when Rustlings isn't run from the right directory (#123)
- Verify that rust version is recent enough to install Rustlings (#131)
- Adds a way to install Rustlings in one command (
curl -L https://git.io/rustlings | bash
) - Makes
rustlings watch
react to create file events (@shaunbennett, #117) - Reworks the exercise management to use an external TOML file instead of just listing them in the code
Initial release.