Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add move_semantics5 exercise. #746

Merged
merged 5 commits into from
May 17, 2021

Conversation

sateeshkumarb
Copy link
Contributor

@sateeshkumarb sateeshkumarb commented May 6, 2021

  • Added an exercise for move_semantics which helps in improving the understanding of mutable references.
  • Added an exercise for option which helps in understanding of usage of keyword ref

info.toml Outdated Show resolved Hide resolved
info.toml Outdated Show resolved Hide resolved
exercises/option/option3.rs Outdated Show resolved Hide resolved
exercises/option/option3.rs Outdated Show resolved Hide resolved
@sateeshkumarb
Copy link
Contributor Author

@fmoko Now that this PR is approved can you please merge this change. Or are there any additional steps I need to take for this PR to be merged. Thanks.

@shadows-withal shadows-withal merged commit 399ab32 into rust-lang:main May 17, 2021
@shadows-withal
Copy link
Member

@all-contributors please add @sateeshkumarb for code and content

@allcontributors
Copy link
Contributor

@fmoko

I've put up a pull request to add @sateeshkumarb! 🎉

@milesfrain
Copy link

milesfrain commented May 23, 2021

My first instinct was to solve this with & instead of the ref keyword, which worked:

    match &y {
        Some(p) => println!("Co-ordinates are {},{} ", p.x, p.y),

I assume this is the intended solution:

    match y {
        Some(ref p) => println!("Co-ordinates are {},{} ", p.x, p.y),

I'm still hazy on the difference between & vs ref, even after reading https://doc.rust-lang.org/std/keyword.ref.html#-vs-ref

Wondering if this exercise could be made more restrictive to force the ref solution.

@sateeshkumarb
Copy link
Contributor Author

@milesfrain That is a good point and after your comment I did searched around and experimented but I couldn't come up with a way to make this exercise to be restrictive to force ref solution. Thanks for pointing this out.

wh5a pushed a commit to wh5a/rustlings-solutions that referenced this pull request May 25, 2021
* upstream/main:
  fix: move_semantics5 hints
  chore: minor typos in move_semantics5 hints
  docs: update .all-contributorsrc [skip ci]
  docs: update README.md [skip ci]
  feat: Add move_semantics5 exercise. (rust-lang#746)
  fix(try_from_into, from_str): hints for dyn Error
noiffion pushed a commit to noiffion/rustlings that referenced this pull request Aug 20, 2021
* feat: Add move_semantics5 exercise.

* feat: Add option3 exercise

* Address review comments. Fix typos, sentence formatting.

* Remove unwanted newline.

* Address review comments: make comment inline, fix format in print.
bugaolengdeyuxiaoer pushed a commit to bugaolengdeyuxiaoer/rustlings that referenced this pull request Dec 28, 2021
* feat: Add move_semantics5 exercise.

* feat: Add option3 exercise

* Address review comments. Fix typos, sentence formatting.

* Remove unwanted newline.

* Address review comments: make comment inline, fix format in print.
ppp3 pushed a commit to ppp3/rustlings that referenced this pull request May 23, 2022
* feat: Add move_semantics5 exercise.

* feat: Add option3 exercise

* Address review comments. Fix typos, sentence formatting.

* Remove unwanted newline.

* Address review comments: make comment inline, fix format in print.
dmoore04 pushed a commit to dmoore04/rustlings that referenced this pull request Sep 11, 2022
* feat: Add move_semantics5 exercise.

* feat: Add option3 exercise

* Address review comments. Fix typos, sentence formatting.

* Remove unwanted newline.

* Address review comments: make comment inline, fix format in print.
Spacebody pushed a commit to Spacebody/my-rustlings that referenced this pull request Nov 18, 2022
* feat: Add move_semantics5 exercise.

* feat: Add option3 exercise

* Address review comments. Fix typos, sentence formatting.

* Remove unwanted newline.

* Address review comments: make comment inline, fix format in print.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants