1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-12-12 11:14:55 +02:00
rustlings/exercises
frogtd d75759e829
fix(move_semantics5): change &mut *y to &mut x (#814)
Instead of having to explain why 
```rs
let mut x = 100; 
let y = &mut x;
let mut z_owned = *y;
let z = &mut z_owned;
*y += 100;
*z += 1000;
```
and 
```rs
let mut x = 100; 
let y = &mut x;
let z = &mut *y;
*y += 100;
*z += 1000;
```
are different, you still get the point across about having only one mutable reference.
As it stands, this exercise does too much (dereferencing and having only one mutable reference), and by doing so confuses people.

Example of someone being confused by this:
<https://discord.com/channels/273534239310479360/273541522815713281/872689531428692040>
2021-09-25 10:52:18 +02:00
..
clippy docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00
collections docs: Update collections README with HashMap link 2021-07-06 01:31:27 -07:00
conversions Merge pull request #737 from ghost/correct-small-typo 2021-07-08 11:07:21 +02:00
enums docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00
error_handling address review feedback 2021-06-09 23:27:53 -05:00
functions docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00
generics fix: add hints to generics1 and generics2 exercises 2021-05-11 14:50:05 -05:00
if docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00
macros docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00
modules fix(modules2): fix typo (#835) 2021-09-06 16:32:39 +02:00
move_semantics fix(move_semantics5): change &mut *y to &mut x (#814) 2021-09-25 10:52:18 +02:00
option feat: Add move_semantics5 exercise. (#746) 2021-05-17 14:10:40 +02:00
primitive_types docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00
standard_library_types Merge pull request #732 from apogeeoak/iterators5 2021-07-09 12:24:42 +02:00
strings docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00
structs fix: remove trailing whitespace 2021-05-09 17:58:54 -05:00
tests docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00
threads docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00
traits docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00
variables fix(variables5): confine the answer further 2021-06-07 18:22:55 +08:00
quiz1.rs feat(quiz1): add default function name in comment (#838) 2021-09-21 10:43:44 +02:00
quiz2.rs fix(exercises): adding question mark to quiz2 2020-08-25 16:38:41 +02:00
quiz3.rs fix(quiz3): Force an answer to Q2 (#672) 2021-03-16 10:14:25 +01:00
quiz4.rs feat: renames test to quiz, fixes #244 2020-05-19 18:47:44 +02:00
README.md feat(modules): update exercises, add modules3 (#822) 2021-09-03 10:41:12 +02:00

Exercise to Book Chapter mapping

Exercise Book Chapter
variables §3.1
functions §3.3
if §3.5
move_semantics §4.1
primitive_types §4.3
structs §5.1
enums §6
modules §7
collections §8.1, §8.3
strings §8.2
error_handling §9
generics §10
option §10.1
traits §10.2
tests §11.1
standard_library_types §13.2
threads §16.1
macros §19.6
clippy n/a
conversions n/a