Commit graph

232 commits

Author SHA1 Message Date
Daan Wynen bbdc5c6039 refactor(cow1): replace main with tests
Following the discussion in #1195 this is the best I could come up with.
The issue for me (and apparently a few other learners) was that the code
needed to complete the exercise was not _missing_, but was rather there
but wrong.

In the end, what made the difference between this exercise and others
(for me) was that in this exercise I was supposed to learn what to
*expect* of an output. So I think it makes sense here to let the learner
modify the tests and not the code itself.

Fixes #1195

Signed-off-by: Daan Wynen <black.puppydog@gmx.de>

# Conflicts:
#	info.toml
2023-02-14 20:37:33 +01:00
liv 7be4fd891d
Merge pull request #1305 from platformer/issue1298
fix(threads1): make program panic if threads are not joined
2023-02-12 16:50:03 +01:00
h4x5p4c3 6b04848d41 minor changes to hint 2023-01-11 00:23:21 +05:30
Tobias Klauser 7c4a3a2af6
Fix typo in clippy1 hint 2023-01-05 17:14:49 +01:00
seporterfield a5429d59f9
updated file paths for iterators, smart_pointers 2023-01-01 02:46:40 +01:00
seporterfield cb79be921d
reordered smart pointer exercises
Switched rc and arc so rc comes first, since arc is, like the name implies, atomic rc. This gives the exercises a more logical progression.
Moved all smart pointer exercises (box, rc, arc, cow) under threads into their own section. Threads are used in the smart pointer exercises, so they should be introduced first.
2023-01-01 01:32:38 +01:00
platformer 7e4ce38681 fix(threads1): make program panic if threads are not joined
closes #1298
2022-12-26 02:25:43 -06:00
Petr Pucil 4303717951 chore: "rust" -> "Rust" in exercise hints 2022-12-25 18:02:37 +01:00
TK Buristrakul db53dbc126 chore: tidied up unmatched backticks 2022-11-24 19:41:25 +00:00
craymel 2ceb59a11d fix: Update structs3 hint 2022-11-18 23:38:27 +11:00
mokou 2e1630c712 chore: style fixes 2022-11-11 16:12:09 +01:00
liv cade600c91
Merge pull request #1203 from skaunov/patch-2
Correct a link in `threads1` `hint`
2022-09-29 10:47:56 +02:00
liv 6174b5caf0
Merge pull request #1210 from cj81499/iterators1-hint
improve hint for iterators1
2022-09-29 10:44:57 +02:00
Tostapunk 1660f1647e fix: Fix typo in errors5 hint
fixes #1205
2022-09-28 23:40:00 +02:00
Cal Jacobson efdebd48b6
improve hint for iterators1 2022-09-25 15:22:15 -05:00
skaunov c0b3194a55
Correct a link in threads1 hint
It didn't work without last character
2022-09-17 00:26:05 +03:00
skaunov 3028d1395c
Add link to std in strings3 hint
Seems like it's the first place, where `std` is introduced in Rustlings, and it's a good place to facilitate docs discovery for user. As _the book_ seems to have no Rustlings-sized solutions for this exercise.
2022-09-13 16:33:03 +03:00
Miguel Raz Guzmán Macedo c97e659d78
typox fix 2022-09-05 10:18:45 -05:00
Gabriel Bianconi 86506fa5fd
Fix typo in threads3 hint 2022-08-22 23:47:23 -04:00
magnusrodseth 52a29aa84b test: Convert main function to working tests 2022-08-17 12:50:34 +02:00
liv 1c3b003c7c
Merge branch 'main' into rc-exercise 2022-08-16 09:37:34 +02:00
liv 25ab52b8e7
Merge pull request #1103 from exdx/feat/cow
feat: add cow1.rs exercise
2022-08-16 09:35:53 +02:00
Mikael Frosthage 5ff23a2861 Improve hint for as_ref_mut 2022-07-26 22:02:50 +02:00
Claire Wang a3a5fbeddf fix: remove extra " typo in info.toml 2022-07-25 19:00:35 -07:00
Denton24646 72e21a2a6c feat: add cow1.rs exercise 2022-07-23 17:59:53 -04:00
Jeremy Goh 301bc52857
fix: lineno typo 2022-07-24 00:37:40 +08:00
Jeremy Goh f88c7d1e8c
fix: reference to variables4 2022-07-24 00:36:27 +08:00
Greg Leonard f9413b8ae1 fix(traits5): fix "paramter" spelling 2022-07-19 20:05:04 +01:00
Eric Jolibois 8a4dca5fa6
remove small typo in hint of threads3 2022-07-19 11:45:34 +02:00
Mattia Schiavon e1d6abb4c9
Apply suggestions from code review
Co-authored-by: liv <mokou@fastmail.com>
2022-07-18 14:44:16 +02:00
Tostapunk 02d78c3e84 fix: Improve hint of lifetimes2
fixes #1071
2022-07-18 14:11:51 +02:00
Denton24646 ce86d252e5 feat: add rc1.rs exercise 2022-07-16 17:39:03 -04:00
Sam White 63b0c7e399 feat: add traits5.rs exercise 2022-07-15 14:14:15 +02:00
Sam White 599d634ee2 feat: Add traits4.rs exercise 2022-07-15 14:13:44 +02:00
Sam White f43c6d7877 feat: Add traits3.rs exercise 2022-07-15 14:13:15 +02:00
jayber 1ef8dacaf6 feat: add lifetimes exercises 2022-07-15 14:03:38 +02:00
exdx a3b5278b42 feat: add threads3.rs exercise 2022-07-15 13:28:49 +02:00
mokou b609f0431c feat: remove advanced_errs 2022-07-15 12:51:12 +02:00
mokou 8cfedb1673 feat(clippy): add clippy3 2022-07-15 12:28:47 +02:00
mokou 7fc393bed4 chore: remove quiz4 2022-07-15 12:13:40 +02:00
mokou d3a335bc64 feat(macros): add hint comments 2022-07-15 12:05:26 +02:00
jaystile b4f52cb937 feat: Adding threads1.rs with a focus on JoinHandles and waiting for
spawned threads to finish. Moved the original threads1.rs to threads2.rs
with the focus on the Mutex and modifying shared data. #892
2022-07-15 11:58:26 +02:00
mokou 20024d40c5 feat(iterators): update hint comments 2022-07-14 18:29:09 +02:00
mokou cf9629cb0e feat: move box/arc behind iterators 2022-07-14 18:17:23 +02:00
mokou 98b8d3f17d feat(traits): add hint comments 2022-07-14 18:14:41 +02:00
mokou 5979d408a9 feat: move generics3 to be quiz3 2022-07-14 18:11:18 +02:00
mokou c34e2adcbb feat(errors): Improve comments and hints 2022-07-14 18:02:33 +02:00
Noah Cairns 5e1ca4b995 fix(errors5): improve exercise instructions 2022-07-14 17:59:29 +02:00
mokou b71feed824 feat(options): add hint comments 2022-07-14 17:53:42 +02:00
mokou b644558c19 fix: rename option to options 2022-07-14 17:34:50 +02:00
mokou c64b340622 feat: rework quiz2 2022-07-14 13:24:15 +02:00
mokou f443f4e7b3 feat: move quiz2 to be strings4 2022-07-14 13:01:40 +02:00
Sateesh Basavaraju 1e54bc61e8 feat: Add hashmap3 exercise. 2022-07-14 12:57:47 +02:00
mokou c1ed6b10fe feat(strings): add strings3 2022-07-14 12:31:28 +02:00
mokou f5e4c16eed feat(strings): move before modules 2022-07-14 12:18:21 +02:00
mokou c6bc97adc1 feat(enums3): add hint comment, remove enums1 hint 2022-07-14 12:11:38 +02:00
Ryosuke YASUOKA d0e8efd19e feat(enums3): Add hint 2022-07-14 12:11:15 +02:00
mokou 4dffa0d10d fix(structs1): rename to unit-like struct 2022-07-14 12:00:46 +02:00
mokou 19bec50399 feat(structs1): convert structs to use i32 types 2022-07-14 11:59:29 +02:00
exdx 16ff57bbff fix(move_semantics2): clarify referencing 2022-07-12 15:26:55 +02:00
mokou bb0cf92b8b feat(move_semantics): clarify some hints 2022-07-12 15:25:31 +02:00
mokou 3c4c9c54c9 feat: remove collections to hashmaps 2022-07-12 15:18:05 +02:00
mokou 2f7fd51304 feat: move vec exercises into their own folder 2022-07-12 15:16:25 +02:00
mokou 8e1f617d34 feat(vec): update vec exercises 2022-07-12 15:05:47 +02:00
mokou 6020ec1fe2 feat: reorder vec and primtypes before moving 2022-07-12 14:53:56 +02:00
mokou 742fb08e01 feat(functions): more small fixes 2022-07-12 11:08:29 +02:00
Cooper Gillan b3ec8fe022 chore: Tweak punctuation in variables6.rs hint
While the meaning is still obvious as is, it makes a little more sense
to use a colon here =)
2022-07-11 13:53:31 +02:00
Cooper Gillan 9688609d08 chore: Update variables6.rs hint book link, wording
While the included link for variables6 does navigate to the correct
page, the header in the link itself does not actually exist so it
only loads the top of the page. There is, however, some text about
the difference between variables and constants in the "Constants"
section, so reword the hint some and update the link.
2022-07-11 13:53:09 +02:00
mokou 81edc4234f fix(variables): reorder and redo hint texts 2022-07-11 13:43:41 +02:00
mokou 9ed4b0683e fix(intro1): link to exercise file in hint 2022-07-11 13:20:18 +02:00
mokou 0aee54a82b chore: unify hint language use 2022-07-11 13:12:47 +02:00
Konstantin baca5d62ae
fix: update link to book 2022-06-13 21:30:25 +02:00
Jesse van Papenrecht 0bdb5207b5
typo fix in hint message if2 2022-05-22 18:56:26 +02:00
Lucas Grigolon Varela b0e079e6bf
Update info.toml 2022-05-20 20:26:37 -03:00
Ron Lusk b821ffdd33 docs(move_semantics5): Replace "in vogue" with "in scope" in hint
The hint for `move_semantics5` refers to "the range in which each
mutable reference is in vogue". Unless this is a deliberate
introduction of "vogue" (an admittedly-useful term because "scope"
isn't purely lexical, as in many other languages), it may be in error:
I have been unable to find the term used with reference to *Rust*
references.

Thus, I'm suggesting the replacement, in case it's been overlooked.
2022-04-22 09:04:36 -04:00
mokou 76a36dd385 chore: update errors1 comments and hint 2022-04-14 10:32:43 +02:00
Lucas Aries 3f0e1303e0
feat: Add move_semantics6.rs exercise (#908) 2022-03-29 15:02:35 +02:00
diannasoreil 4cde788d33
Merge pull request #733 from apogeeoak/intro
feat(intro): Proposal to add successfully compiling exercise as the first exercise.
2022-02-04 15:26:15 +01:00
Franklin van Nes f2650de369 fix(clippy1): Updated code to test correctness clippy lint with approx_constant lint rule
closes #888
2021-12-15 11:46:27 -05:00
alirezaghey 8ef4869b26
fix(functions5): Remove wrong new line and small English improvements (#885) 2021-12-15 10:44:21 +01:00
rlch 1c0fe3cbcc fix: few spelling mistakes 2021-10-02 23:59:23 +10:00
diannasoriel c2ed98deb3
Merge pull request #781 from tlyu/advanced-errs
feature: advanced errors
2021-09-25 11:18:55 +02:00
Taylor Yu abd6b70c72 feat: add advanced_errs2
New exercise to demonstrate traits that make it easier for other code
to consume our custom error types.
2021-09-25 11:18:23 +02:00
Taylor Yu 882d535ba8 feat: add advanced_errs1
New section and exercise to demonstrate the `From` trait for errors
and its usefulness with the `?` operator.
2021-09-25 11:18:21 +02:00
anuk909 dfd2fab4f3
feat(modules): update exercises, add modules3 (#822)
Co-authored-by: diannasoriel <mokou@fastmail.com>
2021-09-03 10:41:12 +02:00
ana df25684cb7 fix(move_semantics5): Clarify instructions 2021-07-29 12:37:15 +02:00
arlecchino 9bf4c5e8df
chore: clippy1 hint enhancement
Added some explanation and links about floating point representation and to use the clippy suggestion. (fixes #390)
2021-06-29 20:47:32 +02:00
arlecchino a4a1098766
Update info.toml
Co-authored-by: marisa <mokou@fastmail.com>
2021-06-29 13:41:16 +02:00
arlecchino 34ea029df8
chore: Update hint of iterators3
`collect()` needs some hint for standard_library_types/iterators3 exercise with doc link for understanding different return types via `FromIterator`.
2021-06-29 12:03:18 +02:00
Taylor Yu 2dc93cadda fix(from_str, try_from_into): custom error types
Remove the use of trait objects as errors from `from_str` and
`try_from_into`; they seem to have caused a lot of confusion in
practice. (Also, it's considered best practice to use custom error
types instead of boxed errors in library code.) Instead, use custom
error enums, and update hints accordingly. Hints also provide
some guidance about converting errors, which could be covered
more completely in a future advanced errors section.

Also move from_str to directly after the similar exercise `from_into`,
for the sake of familiarity when solving.
2021-06-24 21:33:41 -05:00
marisa a3ea37b76e
Merge pull request #771 from tlyu/iterators5-trait-tweak
fix(iterators5): derive Clone, Copy
2021-06-24 14:17:05 +02:00
Taylor Yu b7ddd09fab address review feedback
Adjust error text and naming to conform with best practices.
Use `map_err()` instead of `or()`. Wrap lower-level errors instead of
ignoring their details.

Also, don't "cheat" by bypassing the `new()` function in tests.

Fix a dangling reference in the try_from_into hints.
2021-06-09 23:27:53 -05:00
Taylor Yu 68d3ac567c feature: improve error_handling exercises
Add new exercises errors5 and errors6, to introduce boxed errors and
custom error enums more gently. Delete errorsn, because it tried to do
too much too soon.
2021-06-06 23:08:57 -05:00
Taylor Yu 50ab289da6 fix: rename result1 to errors4
Also put it in the ERROR HANDLING section where it probably belongs.
2021-06-06 23:08:54 -05:00
Taylor Yu 4e079fdd08 chore(iterators5): conciseness hint 2021-06-06 17:45:35 -05:00
Taylor Yu 1b85828548 fix: move_semantics5 hints
Improve the hints for move_semantics5, as well as the explanatory
comments in the code.

Previously, it was not clear what possible changes were allowed.
It seems that reordering the statements might be the intended solution.
The previous comment about not "adding newlines" doesn't make sense,
so treating it as "adding new lines" makes it more clear.
2021-05-22 22:09:58 -05:00
Taylor Yu 4c46e5e1a3 chore: minor typos in move_semantics5 hints 2021-05-22 21:56:14 -05:00
Sateesh 399ab328d8
feat: Add move_semantics5 exercise. (#746)
* 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.
2021-05-17 14:10:40 +02:00
Taylor Yu 11d2cf0d60 fix(try_from_into, from_str): hints for dyn Error
Add hints about how to return the correct type for functions that
return `Result<_, Box<dyn Error>`. Some feedback from Discord suggests
that people run into trouble with that.
2021-05-15 14:01:17 -05:00
apogeeoak 21c9f44168 feat(intro): Add intro section. 2021-04-24 13:15:34 -04:00