1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-12-12 11:14:55 +02:00
Commit Graph

146 Commits

Author SHA1 Message Date
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
Brandon Macer
81be404487
feat(arc1): Add more details to description and hint (#710)
Co-authored-by: bmacer <bmacer@cisco.com>
Co-authored-by: marisa <mokou@fastmail.com>
Co-authored-by: Roberto Vidal <vidal.roberto.j@gmail.com>
2021-04-21 14:50:03 +02:00
marisa
79cc657917
Merge pull request #646 from apogeeoak/iterator
Added iterators5.rs exercise.
2021-04-21 10:10:50 +02:00
apogeeoak
9c88ea9126 Improved iterators5.rs explanation. 2021-04-20 18:55:04 -04:00
marisa
2b766ef9f9
Merge pull request #648 from apogeeoak/iterator2
Moved iterators2.rs errors out of tests.
2021-04-20 11:24:10 +02:00
marisa
bd3d9ac9d5
Merge pull request #649 from apogeeoak/iterator3
Enabled iterators3.rs to run without commented out tests.
2021-04-20 11:22:39 +02:00
Abdou Seck
caf921a01f
Merge pull request #674 from Morsicus/fix/collections-exercises-naming
Update collections exercises naming
2021-04-13 10:39:18 -04:00
Taylor Yu
c3e7b83178 fix: use trait objects for from_str
Use `Box<dyn error::Error>` to allow solutions to use `?` to propagate 
errors.
2021-04-04 18:56:10 -05:00
Mickael Fortunato
bef39b1259 fix(collections): Naming exercises for vectors and hashmap 2021-03-18 19:11:04 +01:00
apogeeoak
96c56ab08a
chore: changed errors3 mode from test to compile 2021-03-12 20:04:29 +01:00
Cyrus Wyett
5157f56875
chore: fix typo
is however some --> are however some
2021-03-12 15:38:28 +01:00
apogeeoak
c6712dfccd fix(iterators3): Enabled iterators3.rs to run without commented out tests. 2021-02-12 15:36:53 -05:00
apogeeoak
baf4ba175b fix(iterators2): Moved errors out of tests.
Closes #359
2021-02-11 21:24:32 -05:00
apogeeoak
b29ea17ea9 feat: Added iterators5.rs exercise. 2021-02-10 18:03:29 -05:00
John Baber-Lucero
cddc1e86e7
fix(info): Fix typo (#635)
Co-authored-by: John Baber-Lucero <git@frundle.com>
2021-01-30 17:12:06 +01:00
fmoko
5772589dc3
Merge pull request #615 from wsh/docfixes
docs: mention flatten in the options2 hint
2021-01-04 14:12:11 +01:00
Will Hayworth
e9b42bbc2a docs: mention flatten in the options2 hint 2021-01-03 03:42:39 -08:00
JuliaCao
90cfb6ff28 fix: added missing exercises to info.toml 2020-12-12 10:34:59 -08:00
JuliaCao
033bf1198f
feat: match exercise order to book chapters (#541)
Added exercise to book chapter mapping table to exercise README
2020-12-07 15:37:19 +01:00
Brock
9334783da3
fix(structs1): Adjust wording (#573)
Co-authored-by: fmoko <mokou@posteo.de>
2020-11-08 10:31:45 +01:00
sazid
633c00cf80 feat: Add HashMap exercises 2020-10-31 01:11:04 +06:00
sazid
0c12fa31c5 feat: Add Vec exercises 2020-10-31 01:10:49 +06:00
Rastamo
e6bde22f9c
chore: primitive_types6 mode changed to test (#559)
primitive_types6 exercise was changed to test yesterday, but info.toml file wasn't updated.
I think this change should fix it.
2020-10-11 14:00:03 +02:00
fmoko
0f16463794
Merge pull request #489 from mukundbhudia/iterators1 2020-09-18 15:23:28 +02:00
Mukund Bhudia
8ff5fde88e
Update info.toml for typo fix
Co-authored-by: Andrew Marquez <andy2mgcc@gmail.com>
2020-09-18 10:40:11 +01:00
Ryan McQuen
3286c5ec19
fix(using_as): Add test so that proper type is returned. (#512) 2020-09-07 19:09:27 +02:00
Koalab99
ee7cdc66b3
chore: Removed extra whitespaces
Co-authored-by: Corentin ARNOULD <corentin.arn@gmail.com>
2020-08-27 19:51:19 +02:00
Mukund Bhudia
9642f5a3f6 feat: Added iterators1.rs exercise 2020-08-04 12:57:01 +01:00
iamcastelli
ddd98ad75d
fix: Change then to than
`than` makes more grammatical sense than `then` in this context.
2020-06-27 15:58:53 +04:00
fmoko
e1e453075f
Merge pull request #422 from AbdouSeck/show-tests-prints 2020-06-12 23:04:51 +02:00
Alexx Roche
e6bd8021d9
fix(generics2): Guide students to the answer (#430) 2020-06-09 13:54:18 +02:00
Abdou Seck
8ad5f9bf53 feat: Add a --nocapture option to display test harnesses' outputs
This new feature can be accessed by invoking rustlings with --nocapture.

Both unit and integration tests added.

closes #262

BREAKING CHANGES:
The following function take a new boolean argument:
	* `run`
	* `verify`
	* `test`
	* `compile_and_test`
2020-06-04 11:18:26 -04:00
Alexx Roche
0dd1c6ca6b
fix: rename quiz1 to tests1 in info (#420)
`rustlings run tests1` wasn't working because of this typo.
2020-06-03 20:07:06 +02:00
fmoko
5f0806967c
Merge pull request #409 from AlexandruGG/feature/box-exercise 2020-05-30 17:58:16 +02:00
Allan Soares Duarte
500422d594
chore: Update variables6.rs book link 2020-05-28 09:33:15 +02:00
AlexandruGG
df81141d6f Address PR feedback: add tests 2020-05-27 10:03:59 +01:00
AlexandruGG
7479a4737b feat: Add box1.rs exercise 2020-05-26 21:46:24 +01:00
Sanjay K
010a045692
feat: renames test to quiz, fixes #244
BREAKING CHANGE

* changed test to quiz: fixes issues in #244
* fixed info.toml: #244
* fixed naming related issues
2020-05-19 18:47:44 +02:00
IkaR49
763aa6e378
feat: Rewrite try_from_into (#393) 2020-05-15 23:02:57 +02:00
Jawaad Mahmood
9f75554f2a
fix(options1): Add hint about Array Initialization (#389) 2020-05-10 13:21:29 +02:00
fmoko
7c4b1f910c
Merge pull request #372 from DiD92/exercise_structs3 2020-05-03 19:44:26 +02:00
Rob Story
1da84b5f7c feat: Add if2 exercise 2020-05-02 13:02:16 -07:00
Dan Wilhelm
9590082848 fix: update iterator and macro text for typos and clarity
- /macros/README.md: Typo "modules" => "macros"
- iterators2.py: Reduce line length to <90-char width.
- iterators4.py: Update 'fun' => 'challenge' as per PR#177
- rustlings hint iterators4: improve clarity
2020-04-29 19:11:54 -07:00
Dídac Sementé Fernández
b66e2e0962 feat: Added exercise structs3.rs 2020-04-27 20:26:34 +02:00
Aleksei Trifonov
32721bbc83
chore: fix missing space in the hint for errorsn.rs 2020-04-25 10:25:41 +02:00
Said Aspen
a3a554aeed
Hints for structs1 and structs2 (#355) 2020-04-16 16:21:36 +02:00
Said Aspen
5999acd24a
feat: Add exercise variables6 covering const (#352) 2020-04-14 10:13:20 +02:00
Saurav
abd0ec379c
chore: update variables5.rs book link (#351)
chore: update variables5.rs book link

chore: update variables5.rs book link
2020-04-12 19:35:20 +02:00
fmoko
2b80f6ed41
chore: Remove duplicate option1 exercise 2020-04-11 17:27:10 +02:00
Sanjay K
86b5c08b9b
feat: Add Option2 exercise (#290)
* added option2

* changed up the exercise, modified the help section

* Update exercises/option/option2.rs

Co-Authored-By: fmoko <mokou@posteo.net>

* Update exercises/option/option2.rs

Co-Authored-By: fmoko <mokou@posteo.net>

* Update exercises/option/option2.rs

Co-Authored-By: fmoko <mokou@posteo.net>

Co-authored-by: fmoko <mokou@posteo.net>
2020-04-07 20:16:10 +02:00
fmoko
7ce42941ea
Merge pull request #282 from sanjaykdragon/master
feat: added option exercise
2020-04-05 15:58:09 +02:00
Sanjay K
3f8171475c updated info.toml 2020-04-05 09:45:07 -04:00
fmoko
b135b589e0
Merge pull request #280 from sjmann/generics-exercises
feat: added generics exercises
2020-04-05 14:40:34 +02:00
Vincent Jousse
30e6af6069 Don't hardcode documentation version for traits 2020-03-26 15:22:22 +01:00
Sanjay K
135e5d47a7 feat: added excercise for option 2020-03-05 15:52:54 -05:00
sjmann
5b6e23c323 removed artifact from manual testing 2020-02-28 00:29:30 +00:00
sjmann
29b30ec946 Merge branch 'master' of https://github.com/sjmann/rustlings into generics-exercises 2020-02-28 00:19:45 +00:00
sjmann
76be5e4e99 feat: added new exercises for generics 2020-02-28 00:09:08 +00:00
Mario Reder
1e2fd9c92f feat: Add clippy lints
- adds a new 'clippy' category for exercises
- clippy exercises should throw no warnings
- install script now also installs clippy

is related to https://github.com/rust-lang/rust-clippy/issues/2604
2020-02-26 14:07:07 +01:00
bors
78295ce92f Auto merge of #274 - sjmann:master, r=fmoko
chore: fixed merge conflicts from traits exercises added by s-marios

I hope this doesn't step on any toes but I wanted to try the traits exercises from #216 so I updated them to match the new structure with hints included in info.toml
2020-02-25 21:27:39 +00:00
Stig Johan Berggren
8b971ffab6
Enable test for exercise test4 2020-02-25 14:13:10 +01:00
sjmann
b559cdd73f added traits exercises 2020-02-25 09:48:50 +00:00
Torben Jonas
0c73609e6f feat: Add variables5.rs exercise
closes #260
2020-01-14 21:10:07 +01:00
Abdou Seck
0c85dc1193 feat: Add type conversion and parsing exercises 2019-12-16 09:12:13 -05:00
Roberto Vidal
b565c4d3e7 fix: line numbers in several exercises and hints
The introduction of `I AM NOT DONE` shifted the lines of all
exercises, which now need adjustment.
2019-11-14 08:21:56 +01:00
Anastasis Georgoulas
4c5189df2b fix(primitive_types4): update outdated hint
Exercise was changed to test (and the order was switched) in #209.
2019-11-13 23:23:34 +00:00
Anastasis Georgoulas
a09f684f05 fix(strings2): update line number in hint 2019-11-13 23:23:34 +00:00
ageorgou
8cc5af121c
Fix(functions4): Update line number in hint 2019-11-12 23:49:19 +00:00
marisa
1a7bb5a400 Address feedback 2019-11-11 17:47:45 +01:00
marisa
795b6e3480 fix(info): Fix trailing newlines for hints 2019-11-11 16:56:39 +01:00
marisa
9bdb0a12e4 feat: Refactor hint system
Hints are now accessible using the CLI subcommand `rustlings hint
<exercise name`.

BREAKING CHANGE: This fundamentally changes the way people interact with exercises.
2019-11-11 16:51:38 +01:00
marisa
627cdc07d0 feat: Index exercises by name
BREAKING CHANGE: This changes the way you use `rustlings run` by now
requiring an abridged form of the previous filename, e.g:

`rustlings run exercises/if/if1.rs` becomes
`rustlings run if1`
2019-11-11 15:46:32 +01:00
marisa
fbe91a67a4 fix(threads): Move Threads behind SLT
Closes #205.
2019-11-11 13:48:09 +01:00
marisa
6dcecb38a4 fix(strings): Move Strings before Structs
Closes #204.
2019-11-11 13:46:42 +01:00
Thomas Holloway
dc15032112 feat: Add enums exercises 2019-10-28 22:49:49 -05:00
Viacheslav Avramenko
1c4c8764ed feat: Added exercise for struct update syntax 2019-10-21 14:50:59 +02:00
Dylan Nugent
5b1e673cec fix(primitive_types4): Fail on a slice covering the wrong area
This commit converts primitive_types4 to a test and asserts that the
slice given is equal to the expected slice.

The intent of the primitive_types4 exercise appears to be to ensure the
user understands inclusive and exclusive bounds as well as slice syntax.
`rustlings` commands using `compile` do not verify that a specific
println is reached and, in the case of `watch` and `verify` (but not
`run`), they do not output the `println`s at all.

This fix is semantically similar to #198. It does not take a stance on
the correct way to handle this for all exercises; see #127. There are
likely other exercises whose intent are masked by this issue.
2019-08-17 17:16:19 -07:00
Niklas Anderson
a750e4a1a3 fix(option1): Add test for prematurely passing exercise
Fixes the bug referenced in #160, but does not address the larger feature work referenced by the issue.
2019-07-26 16:58:12 -07:00
Jesse
9288fccf07 feat(iterators2): adds iterators2 exercise including config 2019-07-03 21:06:24 +10:00
Russell Cousineau
433d2115bc fix(iterators): Rename iterator3.rs 2019-06-07 14:42:44 -07:00
Brian Kung
9b92aa08ae Adds a simple exercise for structures 2019-05-25 06:39:58 -05:00
LesnyRumcajs
58ccd72aff
Add standard library types to exercises suite 2019-03-13 15:29:02 +01:00
lyn
70e59cca3c standardize exercise running via an external toml file 2019-03-06 21:47:33 +01:00