rustlings/exercises
lionel-rowe 836134202e
feat(options2): better tests for layered_option
The existing test can be solved with the following:

```rs
        while let Some(integer) = optional_integers.pop() {
            assert_eq!(integer.unwrap(), range);
```

Similarly with `expect(...)`, `unwrap_or(0)`, `unwrap_or_default()`, etc. However, none of these solutions use the learning point of stacking `Option<T>`s.

The updated test can _only_ be solved by stacking `Option<T>`s:

```rs
        while let Some(Some(integer)) = optional_integers.pop() {
            assert_eq!(integer, cursor);
```

With the updated test, using `unwrap` or `expect` will panic when it hits the `None` value, and using `unwrap_or` or `unwrap_or_default` will cause the final `assert_eq!(cursor, 0)`  to panic.
2023-04-21 06:05:25 +01:00
..
clippy fix: re-add missing done comments 2022-07-15 13:24:11 +02:00
conversions feat(docs): add markdown linter for exercises README.md files 2023-03-30 19:53:22 +03:30
enums chore: update enums3.rs addressing extra parentheses usage with tuples 2022-12-30 08:14:13 -06:00
error_handling docs(error_handling): resolve markdown linter warnings 2023-03-29 21:13:27 +03:30
functions feat(functions): more small fixes 2022-07-12 11:08:29 +02:00
generics feat: move generics3 to be quiz3 2022-07-14 18:11:18 +02:00
hashmaps fix(exercises): remove trailing spaces 2023-03-31 11:58:15 +02:00
if fix(if2): Rename if2 exercise function to foo_if_fizz. 2022-07-12 11:13:04 +02:00
intro feat(intro1): add note on rust-analyzer usage 2023-02-12 15:47:58 +01:00
iterators Merge pull request #1391 from ktheory/ktheory/iter5 2023-04-05 13:06:43 +00:00
lifetimes fix(exercises): remove trailing spaces 2023-03-31 11:58:15 +02:00
macros fix(exercises): remove trailing spaces 2023-03-31 11:58:15 +02:00
modules fix(modules): adjust hint comments 2022-07-14 12:35:49 +02:00
move_semantics fix(move_semantics2): add expected output comment 2023-02-18 18:43:34 +01:00
options feat(options2): better tests for layered_option 2023-04-21 06:05:25 +01:00
primitive_types fix(primitive_types): clean up 2022-07-12 15:22:01 +02:00
smart_pointers feat(docs): add markdown linter for exercises README.md files 2023-03-30 19:53:22 +03:30
strings fix: make strings3.rs comment wording more clear 2022-07-16 17:28:13 +02:00
structs Added spaces around * 2022-10-04 11:43:23 +02:00
tests changed comments in tests 2023-04-05 13:24:14 +02:00
threads fix(exercises): remove trailing spaces 2023-03-31 11:58:15 +02:00
traits feat(docs): add markdown linter for exercises README.md files 2023-03-30 19:53:22 +03:30
variables docs(variables): wrap mut keyword with backtick 2023-03-28 09:58:59 +03:30
vecs Rename iteration var names in vec2.rs for clarity 2023-03-10 14:13:06 -05:00
quiz1.rs fix(quiz1): add fourth assert 2022-09-06 12:10:53 +02:00
quiz2.rs Minor Grammar 2023-01-03 09:22:52 -05:00
quiz3.rs feat: move generics3 to be quiz3 2022-07-14 18:11:18 +02:00
README.md added existing chapter for clippy to mapping 2023-01-01 02:34:58 +01:00

Exercise to Book Chapter mapping

Exercise Book Chapter
variables §3.1
functions §3.3
if §3.5
primitive_types §3.2, §4.3
vecs §8.1
move_semantics §4.1-2
structs §5.1, §5.3
enums §6, §18.3
strings §8.2
modules §7
hashmaps §8.3
options §10.1
error_handling §9
generics §10
traits §10.2
tests §11.1
lifetimes §10.3
iterators §13.2-4
threads §16.1-3
smart_pointers §15, §16.3
macros §19.6
clippy §21.4
conversions n/a