rustlings
Releases
Rustlings 6.4.0
Added
- The list of exercises is now searchable by pressing
s
or/
ποΈ (thanks to @frroossst) - New option
c
in the prompt to manually check all exercises β (thanks to @Nahor) - New command
check-all
to manually check all exercises β (thanks to @Nahor) - Addictive animation for showing the progress of checking all exercises. A nice showcase of parallelism in Rust β¨
- New option
x
in the prompt to reset the file of the current exercise π - Allow
dead_code
for all exercises and solutions β°οΈ (thanks to @huss4in) - Pause input while running an exercise to avoid unexpected prompt interactions βΈοΈ
- Limit the maximum number of exercises to 999. Any third-party exercises willing to reach that limit? π
Changed
enums3
: Remove redundant enum definition task (thanks to @senekor)if2
: Make the exercise less confusing by avoiding "fizz", "fuzz", "foo", "bar" and "baz" (thanks to @senekor)hashmap3
: Use the methodEntry::or_default
.- Update the state of all exercises when checking all of them (thanks to @Nahor)
- The main prompt doesn't need a confirmation with ENTER on Unix-like systems anymore.
- No more jumping back to a previous exercise when its file is changed. Use the list to jump between exercises.
- Dump the solution file after an exercise is done even if the solution's directory doesn't exist.
- Rework the footer in the list.
- Optimize the file watcher.
Fixed
- Fix bad contrast in the list on terminals with a light theme.
Rustlings 6.3.0
Added
- Add the following exercise lints:
forbid(unsafe_code)
: You shouldn't write unsafe code in Rustlings.forbid(unstable_features)
: You don't need unstable features in Rustlings and shouldn't rely on them while learning Rust.forbid(todo)
: You forgot atodo!()
.forbid(empty_loop)
: This can only happen by mistake in Rustlings.deny(infinite_loop)
: No infinite loops are needed in Rustlings.deny(mem_forget)
: You shouldn't leak memory while still learning Rust.
- Show a link to every exercise file in the list.
- Add scroll padding in the list.
- Break the help footer of the list into two lines when the terminal width isn't big enough.
- Enable scrolling with the mouse in the list.
dev check
: Show the progress of checks.dev check
: Check that the length of all exercise names is lower than 32.dev check
: Check if exercise contains no tests and isn't marked withtest = false
.
Changed
- The compilation time when installing Rustlings is reduced.
- Pressing
c
in the list for "continue on" now quits the list after setting the selected exercise as the current one. - Better highlighting of the solution file after an exercise is done.
- Don't show the output of successful tests anymore. Instead, show the pretty output for tests.
- Be explicit about
q
only quitting the list and not the whole program in the list. - Be explicit about
r
only resetting one exercise (the selected one) in the list. - Ignore the standard output of
git init
. threads3
: Remove the queue length and improve tests.errors4
: Use match instead of a comparison chain in the solution.functions3
: Only takeu8
to avoid using a too high number of iterations by mistake.dev check
: Always check with strict Clippy (warnings to errors) when checking the solutions.
Fixed
- Fix the error on some systems about too many open files during the final check of all exercises.
- Fix the list when the terminal height is too low.
- Restore the terminal after an error in the list.
Rustlings 6.2.0
Added
- Show a message before checking and running an exercise. This gives the user instant feedback and avoids confusion if the checks take too long.
- Show a helpful error message when trying to install Rustlings with a Rust version lower than the minimum one that Rustlings supports.
- Add a
README.md
file to thesolutions/
directory. - Allow initializing Rustlings in a Cargo workspace.
dev check
: Check that all solutions are formatted withrustfmt
.
Changed
- Remove the state file and the solutions directory from the generated
.gitignore
file. - Run the final check of all exercises in parallel.
- Small exercise improvements.
Rustlings 6.1.0
Added
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).
Changed
- Make enum variants more consistent between enum exercises.
iterators3
: Teach about the possible case of integer overflow during division.
Fixed
- Exit with a helpful error message on missing/unsupported terminal/TTY.
- Mark the last exercise as done.
Rustlings 6.0.1
Rustlings 6.0.0
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.
Installation
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.
UI/UX
- 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.
List mode
A new list mode was added!
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.
Solutions
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.
LSP support out of the box
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
Clippy lints are now shown on all exercises, not only the Clippy exercises π Make Clippy your friend from early on π₯°
Third-party exercises
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!
Rustlings 5.6.1
Changed
- Converted all exercises with assertions to test mode.
Fixed
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
.
Rustlings 5.6.0
Added
- 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.
Changed
- 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.
Fixed
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.
Housekeeping
- 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.
Rustlings 5.5.1
Rustlings 5.5.0
Added
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
Changed
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
Fixed
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
Housekeeping
- Added a markdown linter to run on GitHub actions
- Split quick installation section into two code blocks
Rustlings 5.4.1
Changed
vecs
: Added links toiter_mut
andmap
to README.mdcow1
: Changed main to testsiterators1
: Formatted according to rustfmt
Fixed
errors5
: Unified undisclosed type notationarc1
: Improved readability by avoiding implicit dereferencemacros4
: Prevented auto-fix by adding#[rustfmt::skip]
cli
: Actually show correct progress percentages
Rustlings 5.4.0
Changed
- 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
Fixed
- 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
Housekeeping
- Bumped min Rust version to 1.58 in installation script
Rustlings 5.3.0
Added
- cli: Added a percentage display in watch mode
- Added a
flake.nix
for Nix users
Changed
- structs3: Added an additional test
- macros: Added a link to MacroKata in the README
Fixed
- 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
Housekeeping
- Added a VSCode extension recommendation
- Applied some Clippy and rustfmt formatting
- Added a note on Windows PowerShell and other shell compatibility
Rustlings 5.2.1
Rustlings 5.2.0
Rustlings 5.1.1
Rustlings 5.1.0
Features
- Added a new
rc1
exercise. - Added a new
cow1
exercise.
Bug Fixes
- 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
Housekeeping
- 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
Rustlings 5.0.0
Features
- 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.
Bug Fixes
- 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
- 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.
Housekeeping
- 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.
Rustlings 4.8.0
Features
- Added a progress indicator for
rustlings watch
. - The installation script now checks for Rustup being installed.
- Added a
rustlings lsp
command to enablerust-analyzer
.
Bug Fixes
- 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.
Housekeeping
- Replaced the git.io URL with the fully qualified URL because of git.io's sunsetting.
- Removed the deprecated Rust GitPod extension.
Rustlings 4.7.1
Features
- 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)
Bug Fixes
- 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.
Housekeeping
- The changelog will now be manually written instead of being automatically generated by the Git log.
Rustlings 4.7.0
Features
- 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)
Bug Fixes
- 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)
Documentation improvements
Rustlings 4.6.0
Features
- 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)
Bug Fixes
Rustlings 4.5.0
Features
- Add move_semantics5 exercise. (#746) (399ab328)
- cli: Add "next" to run the next unsolved exercise. (#785) (d20e413a)
Bug Fixes
- 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)
Rustlings 4.4.0
Bug Fixes
- 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)
Features
Rustlings 4.3.0
Features
- 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)
Bug Fixes
- 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)
Rustlings 4.2.0
Features
- Add HashMap exercises (633c00cf)
- Add Vec exercises (0c12fa31)
- primitive_types6: Add a test (#548) (2b1fb2b7)
- try_from_into: Add tests (#571) (95ccd926)
Bug Fixes
Rustlings 4.1.0
Bug Fixes
- 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)
Features
- 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)
Rustlings 4.0.0
Breaking Changes
- Add a --nocapture option to display test harnesses' outputs (8ad5f9bf)
- Rename test to quiz, fixes #244 (010a0456)
Features
- 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)
Bug Fixes
- 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)
Rustlings 3.0.0
Breaking Changes
- make "compile" exercises print output (#278) (3b6d5c)
Bug Fixes
- primitive_types: revert primitive_types4 (#296) (b3a3351e)
- run: compile clippy exercise files (#295) (3ab084a4)
- conversions:
- don't hardcode documentation version for traits (#288) (30e6af)
Features
- add Option2 exercise (#290) (86b5c08b)
- add exercise for option (#282) (135e5d47)
- add new exercises for generics (#280) (76be5e4e)
- ci: add buildkite config (b049fa2c)
2.2.1 (2020-02-27)
Bug Fixes
- Re-add cloning the repo to install scripts (3d9b03c5)
Features
- Add clippy lints (#269) (1e2fd9c9)