Commit graph

2273 commits

Author SHA1 Message Date
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
de6c45ad24
Merge pull request #779 from rust-lang/all-contributors/add-hyperparabolic
docs: add hyperparabolic as a contributor for code
2021-06-24 14:18:02 +02:00
allcontributors[bot]
fadade8592
docs: update .all-contributorsrc [skip ci] 2021-06-24 12:17:32 +00:00
allcontributors[bot]
d91044f3a2
docs: update README.md [skip ci] 2021-06-24 12:17:31 +00: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
marisa
ec63cadadb
Merge pull request #772 from tlyu/errors-rework
feature: improve error_handling exercises
2021-06-24 14:12:34 +02:00
marisa
84d8305730
Merge pull request #778 from rust-lang/all-contributors/add-kayuapi
docs: add kayuapi as a contributor for content
2021-06-24 14:10:33 +02:00
allcontributors[bot]
73777980f1
docs: update .all-contributorsrc [skip ci] 2021-06-24 12:10:24 +00:00
allcontributors[bot]
75788b1148
docs: update README.md [skip ci] 2021-06-24 12:10:23 +00:00
marisa
dd9b2ddc89
Merge pull request #773 from kayuapi/patch-1
fix(variables5): confine the answer further
2021-06-24 14:10:02 +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
ZC
48ffcbd2c4
fix(variables5): confine the answer further
let mut number = 3; can lead to a correct answer, so the comment helps to direct the users to the intended answer.
2021-06-07 18:22:55 +08: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
91fc9e3118 fix(iterators5): derive Clone, Copy
To allow more flexibility in solutions, derive `Clone` and `Copy`
for `Progress`.
2021-06-06 17:38:02 -05:00
marisa
a2f0401c4c
Merge pull request #762 from tlyu/move-semantics5-fixes
fix: move_semantics5 hints
2021-05-23 15:41:56 +02: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
marisa
4da9e7ee29
Merge pull request #758 from rust-lang/all-contributors/add-sateeshkumarb
docs: add sateeshkumarb as a contributor
2021-05-17 14:11:15 +02:00
allcontributors[bot]
72e615aa7a
docs: update .all-contributorsrc [skip ci] 2021-05-17 12:11:05 +00:00
allcontributors[bot]
cd02abc481
docs: update README.md [skip ci] 2021-05-17 12:11:04 +00: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
marisa
809ec2ce01
Merge pull request #755 from tlyu/dyn-error-hints
fix(try_from_into, from_str): hints for dyn Error
2021-05-17 14:09:44 +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
marisa
dbb2624403
Merge pull request #751 from juanprq/main
fix: remove trailing whitespace
2021-05-13 17:20:47 +02:00
Juan Pablo Ramirez
4d4fa77459 fix: remove trailing whitespaces from iterators1 2021-05-12 10:20:07 -05:00
Juan Pablo Ramirez
3145794084 fix: add hints to generics1 and generics2 exercises 2021-05-11 14:50:05 -05:00
Juan Pablo Ramirez
d9b69bd1a0 fix: remove trailing whitespace 2021-05-09 17:58:54 -05:00
marisa
7cd635fa84
Merge pull request #740 from rust-lang/all-contributors/add-PiDelport
docs: add PiDelport as a contributor
2021-05-01 12:12:51 +02:00
allcontributors[bot]
ce40e201f0
docs: update .all-contributorsrc [skip ci] 2021-05-01 10:12:43 +00:00
allcontributors[bot]
404f3ef465
docs: update README.md [skip ci] 2021-05-01 10:12:42 +00:00
marisa
e1be594fdd
Merge pull request #739 from PiDelport/patch-1
style(standard_library_types): stray line break
2021-05-01 12:12:29 +02:00
Pi Delport
9569c9a9e7
style(standard_library_types): stray line break 2021-04-29 23:31:26 +02:00
apogeeoak
f78c480208 fix(cli): Move long text strings into constants. 2021-04-27 17:14:54 -04:00
Martin HART
8794b40bc6 Merge branch 'correct-small-typo' of github.com:martinhartxyz/rustlings into correct-small-typo 2021-04-27 21:12:44 +02:00
Martin HART
86cc85295a fix: Correct small typo in exercises/conversions/from_str.rs 2021-04-27 21:11:40 +02:00
Martin HART
166a53946c Correct small typo in exercises/conversions/from_str.rs 2021-04-27 20:22:13 +02:00
marisa
91530f5716
Merge pull request #736 from maartentibau/quiz1_add_explicit_test_40
chore: Update quiz1.rs add explicit test for 40
2021-04-27 10:20:50 +02:00
apogeeoak
9b8de65525
fix(intro1): Add compiler error explanation. 2021-04-26 20:28:17 -04:00
Maarten Tibau
650b1dee54
chore: Update quiz1.rs add explicit test for 40 2021-04-25 19:02:50 +02:00
apogeeoak
21c9f44168 feat(intro): Add intro section. 2021-04-24 13:15:34 -04:00
apogeeoak
7f0d2c2bf0 chore(iterators5): Minor formatting improvements. 2021-04-24 12:42:06 -04:00
marisa
6b6dc9dd48
Merge pull request #731 from rust-lang/all-contributors/add-stoiandan
docs: add stoiandan as a contributor
2021-04-24 17:36:48 +02:00
allcontributors[bot]
3a9ec4192d
docs: update .all-contributorsrc [skip ci] 2021-04-24 15:36:39 +00:00
allcontributors[bot]
4f7dbbd2c3
docs: update README.md [skip ci] 2021-04-24 15:36:38 +00:00
marisa
8c37db1a23
Merge pull request #730 from stoiandan/main
updated README.md; specify need for admin rights
2021-04-24 17:36:19 +02:00
Dan Stoian
c6b7ad8878 updated README.md; specify need for admin rights 2021-04-24 18:32:13 +03:00
Zerotask
4a384cae4a
docs(option): improve further information 2021-04-24 12:12:49 +02:00
mokou
84461c20cb release: 4.4.0 2021-04-24 11:57:00 +02:00