Skip to content

Commit 1c3b003

Browse files
authored
Merge branch 'main' into rc-exercise
2 parents ce86d25 + 25ab52b commit 1c3b003

File tree

20 files changed

+329
-42
lines changed

20 files changed

+329
-42
lines changed

.all-contributorsrc

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,132 @@
13711371
"contributions": [
13721372
"content"
13731373
]
1374+
},
1375+
{
1376+
"login": "wojexe",
1377+
"name": "wojexe",
1378+
"avatar_url": "https://avatars.githubusercontent.com/u/21208490?v=4",
1379+
"profile": "https://wojexe.com",
1380+
"contributions": [
1381+
"content"
1382+
]
1383+
},
1384+
{
1385+
"login": "Tostapunk",
1386+
"name": "Mattia Schiavon",
1387+
"avatar_url": "https://avatars.githubusercontent.com/u/25140297?v=4",
1388+
"profile": "https://github.com/Tostapunk",
1389+
"contributions": [
1390+
"content"
1391+
]
1392+
},
1393+
{
1394+
"login": "PrettyWood",
1395+
"name": "Eric Jolibois",
1396+
"avatar_url": "https://avatars.githubusercontent.com/u/18406791?v=4",
1397+
"profile": "http://toucantoco.com",
1398+
"contributions": [
1399+
"content"
1400+
]
1401+
},
1402+
{
1403+
"login": "EdwinChang24",
1404+
"name": "Edwin Chang",
1405+
"avatar_url": "https://avatars.githubusercontent.com/u/88263098?v=4",
1406+
"profile": "http://edwinchang.vercel.app",
1407+
"contributions": [
1408+
"content"
1409+
]
1410+
},
1411+
{
1412+
"login": "saikatdas0790",
1413+
"name": "Saikat Das",
1414+
"avatar_url": "https://avatars.githubusercontent.com/u/7412443?v=4",
1415+
"profile": "https://saikat.dev/",
1416+
"contributions": [
1417+
"content"
1418+
]
1419+
},
1420+
{
1421+
"login": "thatlittleboy",
1422+
"name": "Jeremy Goh",
1423+
"avatar_url": "https://avatars.githubusercontent.com/u/30731072?v=4",
1424+
"profile": "https://github.com/thatlittleboy",
1425+
"contributions": [
1426+
"content"
1427+
]
1428+
},
1429+
{
1430+
"login": "Lioness100",
1431+
"name": "Lioness100",
1432+
"avatar_url": "https://avatars.githubusercontent.com/u/65814829?v=4",
1433+
"profile": "https://github.com/Lioness100",
1434+
"contributions": [
1435+
"content"
1436+
]
1437+
},
1438+
{
1439+
"login": "tvkn",
1440+
"name": "Tristan Nicholls",
1441+
"avatar_url": "https://avatars.githubusercontent.com/u/79277926?v=4",
1442+
"profile": "https://github.com/tvkn",
1443+
"contributions": [
1444+
"content"
1445+
]
1446+
},
1447+
{
1448+
"login": "clairew",
1449+
"name": "Claire",
1450+
"avatar_url": "https://avatars.githubusercontent.com/u/9344258?v=4",
1451+
"profile": "http://clairewang.net",
1452+
"contributions": [
1453+
"content"
1454+
]
1455+
},
1456+
{
1457+
"login": "Mouwrice",
1458+
"name": "Maurice Van Wassenhove",
1459+
"avatar_url": "https://avatars.githubusercontent.com/u/56763273?v=4",
1460+
"profile": "https://github.com/Mouwrice",
1461+
"contributions": [
1462+
"content"
1463+
]
1464+
},
1465+
{
1466+
"login": "johnmendel",
1467+
"name": "John Mendelewski",
1468+
"avatar_url": "https://avatars.githubusercontent.com/u/77524?v=4",
1469+
"profile": "http://jmthree.com",
1470+
"contributions": [
1471+
"code"
1472+
]
1473+
},
1474+
{
1475+
"login": "brianfakhoury",
1476+
"name": "Brian Fakhoury",
1477+
"avatar_url": "https://avatars.githubusercontent.com/u/20828724?v=4",
1478+
"profile": "http://fakhoury.xyz",
1479+
"contributions": [
1480+
"content"
1481+
]
1482+
},
1483+
{
1484+
"login": "markusboehme",
1485+
"name": "Markus Boehme",
1486+
"avatar_url": "https://avatars.githubusercontent.com/u/5074759?v=4",
1487+
"profile": "https://github.com/markusboehme",
1488+
"contributions": [
1489+
"code"
1490+
]
1491+
},
1492+
{
1493+
"login": "nico-vromans",
1494+
"name": "Nico Vromans",
1495+
"avatar_url": "https://avatars.githubusercontent.com/u/48183857?v=4",
1496+
"profile": "https://github.com/nico-vromans",
1497+
"contributions": [
1498+
"content"
1499+
]
13741500
}
13751501
],
13761502
"contributorsPerLine": 8,

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ root = true
22

33
[*.rs]
44
end_of_line = lf
5-
insert_final_newfile = true
5+
insert_final_newline = true
66
indent_style = space
77
indent_size = 4

AUTHORS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,24 @@ authors.
195195
<td align="center"><a href="https://jamesabromley.wordpress.com/"><img src="https://avatars.githubusercontent.com/u/2474334?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James Bromley</b></sub></a><br /><a href="#content-jayber" title="Content">🖋</a></td>
196196
<td align="center"><a href="https://github.com/swhiteCQC"><img src="https://avatars.githubusercontent.com/u/77438466?v=4?s=100" width="100px;" alt=""/><br /><sub><b>swhiteCQC</b></sub></a><br /><a href="#content-swhiteCQC" title="Content">🖋</a></td>
197197
<td align="center"><a href="https://github.com/neilpate"><img src="https://avatars.githubusercontent.com/u/7802334?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Neil Pate</b></sub></a><br /><a href="#content-neilpate" title="Content">🖋</a></td>
198+
<td align="center"><a href="https://wojexe.com"><img src="https://avatars.githubusercontent.com/u/21208490?v=4?s=100" width="100px;" alt=""/><br /><sub><b>wojexe</b></sub></a><br /><a href="#content-wojexe" title="Content">🖋</a></td>
199+
<td align="center"><a href="https://github.com/Tostapunk"><img src="https://avatars.githubusercontent.com/u/25140297?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mattia Schiavon</b></sub></a><br /><a href="#content-Tostapunk" title="Content">🖋</a></td>
200+
<td align="center"><a href="http://toucantoco.com"><img src="https://avatars.githubusercontent.com/u/18406791?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Eric Jolibois</b></sub></a><br /><a href="#content-PrettyWood" title="Content">🖋</a></td>
201+
</tr>
202+
<tr>
203+
<td align="center"><a href="http://edwinchang.vercel.app"><img src="https://avatars.githubusercontent.com/u/88263098?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Edwin Chang</b></sub></a><br /><a href="#content-EdwinChang24" title="Content">🖋</a></td>
204+
<td align="center"><a href="https://saikat.dev/"><img src="https://avatars.githubusercontent.com/u/7412443?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Saikat Das</b></sub></a><br /><a href="#content-saikatdas0790" title="Content">🖋</a></td>
205+
<td align="center"><a href="https://github.com/thatlittleboy"><img src="https://avatars.githubusercontent.com/u/30731072?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeremy Goh</b></sub></a><br /><a href="#content-thatlittleboy" title="Content">🖋</a></td>
206+
<td align="center"><a href="https://github.com/Lioness100"><img src="https://avatars.githubusercontent.com/u/65814829?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lioness100</b></sub></a><br /><a href="#content-Lioness100" title="Content">🖋</a></td>
207+
<td align="center"><a href="https://github.com/tvkn"><img src="https://avatars.githubusercontent.com/u/79277926?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tristan Nicholls</b></sub></a><br /><a href="#content-tvkn" title="Content">🖋</a></td>
208+
<td align="center"><a href="http://clairewang.net"><img src="https://avatars.githubusercontent.com/u/9344258?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Claire</b></sub></a><br /><a href="#content-clairew" title="Content">🖋</a></td>
209+
<td align="center"><a href="https://github.com/Mouwrice"><img src="https://avatars.githubusercontent.com/u/56763273?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Maurice Van Wassenhove</b></sub></a><br /><a href="#content-Mouwrice" title="Content">🖋</a></td>
210+
<td align="center"><a href="http://jmthree.com"><img src="https://avatars.githubusercontent.com/u/77524?v=4?s=100" width="100px;" alt=""/><br /><sub><b>John Mendelewski</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=johnmendel" title="Code">💻</a></td>
211+
</tr>
212+
<tr>
213+
<td align="center"><a href="http://fakhoury.xyz"><img src="https://avatars.githubusercontent.com/u/20828724?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Brian Fakhoury</b></sub></a><br /><a href="#content-brianfakhoury" title="Content">🖋</a></td>
214+
<td align="center"><a href="https://github.com/markusboehme"><img src="https://avatars.githubusercontent.com/u/5074759?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Markus Boehme</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=markusboehme" title="Code">💻</a></td>
215+
<td align="center"><a href="https://github.com/nico-vromans"><img src="https://avatars.githubusercontent.com/u/48183857?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nico Vromans</b></sub></a><br /><a href="#content-nico-vromans" title="Content">🖋</a></td>
198216
</tr>
199217
</table>
200218

CHANGELOG.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,76 @@
1+
<a name="5.0.0"></a>
2+
## 5.0.0 (2022-07-16)
3+
4+
#### Features
5+
6+
- Hint comments in exercises now also include a reference to the
7+
`hint` watch mode subcommand.
8+
- **intro1**: Added more hints to point the user to the source file.
9+
- **variables**: Switched variables3 and variables4.
10+
- Moved `vec` and `primitive_types` exercises before `move_semantics`.
11+
- Renamed `vec` to `vecs` to be more in line with the naming in general.
12+
- Split up the `collections` exercises in their own folders.
13+
- **vec2**: Added a second part of the function that provides an alternative,
14+
immutable way of modifying vec values.
15+
- **enums3**: Added a hint.
16+
- Moved `strings` before `modules`.
17+
- Added a `strings3` exercise to teach modifying strings.
18+
- Added a `hashmaps3` exercise for some advanced usage of hashmaps.
19+
- Moved the original `quiz2` to be `strings4`, since it only tested strings
20+
anyways.
21+
- Reworked `quiz2` into a new exercise that tests more chapters.
22+
- Renamed `option` to `options`.
23+
- **options1**: Rewrote parts of the exercise to remove the weird array
24+
iteration stuff.
25+
- Moved `generics3` to be `quiz3`.
26+
- Moved box/arc exercises behind `iterators`.
27+
- **iterators4**: Added a test for factorials of zero.
28+
- Split `threads1` between two exercises, the first one focusing more on
29+
`JoinHandle`s.
30+
- Added a `threads3` exercises that uses `std::sync::mpsc`.
31+
- Added a `clippy3` exercises with some more interesting checks.
32+
- **as_ref_mut**: Added a section that actually tests `AsMut`.
33+
- Added 3 new lifetimes exercises.
34+
- Added 3 new traits exercises.
35+
36+
#### Bug Fixes
37+
38+
- **variables2**: Made output messages more verbose.
39+
- **variables5**: Added a nudging hint about shadowing.
40+
- **variables6**: Fixed link to book.
41+
- **functions**: Clarified the README wording. Generally cleaned up
42+
some hints and added some extra comments.
43+
- **if2**: Renamed function name to `foo_if_fizz`.
44+
- **move_semantics**: Clarified some hints.
45+
- **quiz1**: Renamed the function name to be more verbose.
46+
- **structs1**: Use an integer type instead of strings. Renamed "unit structs"
47+
to "unit-like structs", as is used in the book.
48+
- **structs3**: Added the `panic!` statement in from the beginning.
49+
- **errors1**: Use `is_empty()` instead of `len() > 0`
50+
- **errors3**: Improved the hint.
51+
- **errors5**: Improved exercise instructions and the hint.
52+
- **errors6**: Provided the skeleton of one of the functions that's supposed
53+
to be implemented.
54+
- **iterators3**: Inserted `todo!` into `divide()` to keep a compiler error
55+
from happening.
56+
- **from_str**: Added a hint comment about string error message conversion with
57+
`Box<dyn Error>`.
58+
- **try_from_into**: Fixed the function name in comment.
59+
60+
#### Removed
61+
62+
- Removed the legacy LSP feature that was using `mod.rs` files.
63+
- Removed `quiz4`.
64+
- Removed `advanced_errs`. These were the last exercises in the recommended
65+
order, and I've always felt like they didn't quite fit in with the mostly
66+
simple, book-following style we've had in Rustlings.
67+
68+
#### Housekeeping
69+
70+
- Added missing exercises to the book index.
71+
- Updated spacing in Cargo.toml.
72+
- Added a GitHub actions config so that tests run on every PR/commit.
73+
174
<a name="4.8.0"></a>
275
## 4.8.0 (2022-07-01)
376

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rustlings"
3-
version = "4.8.0"
3+
version = "5.0.0"
44
authors = ["Liv <mokou@fastmail.com>", "Carol (Nichols || Goulding) <carol.nichols@gmail.com>"]
55
edition = "2021"
66

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ If you get a permission denied message, you might have to exclude the directory
5454

5555
## Manually
5656

57-
Basically: Clone the repository at the latest tag, run `cargo install`.
57+
Basically: Clone the repository at the latest tag, run `cargo install --path .`.
5858

5959
```bash
60-
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 4.7.1)
61-
git clone -b 4.7.1 --depth 1 https://github.com/rust-lang/rustlings
60+
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.0.0)
61+
git clone -b 5.0.0 --depth 1 https://github.com/rust-lang/rustlings
6262
cd rustlings
6363
cargo install --force --path .
6464
```

exercises/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@
55
| variables | §3.1 |
66
| functions | §3.3 |
77
| if | §3.5 |
8-
| move_semantics | §4.1, §4.2 |
98
| primitive_types | §3.2, §4.3 |
9+
| vecs | §8.1 |
10+
| move_semantics | §4.1, §4.2 |
1011
| structs | §5.1, §5.3 |
1112
| enums | §6, §18.3 |
12-
| modules | §7 |
13-
| collections | §8.1, §8.3 |
1413
| strings | §8.2 |
14+
| modules | §7 |
15+
| hashmaps | §8.3 |
16+
| options | §10.1 |
1517
| error_handling | §9 |
1618
| generics | §10 |
17-
| option | §10.1 |
1819
| traits | §10.2 |
1920
| tests | §11.1 |
21+
| lifetimes | §10.3 |
2022
| standard_library_types | §13.2, §15.1, §16.3 |
21-
| threads | §16.1 |
23+
| threads | §16.1, §16.2, §16.3 |
2224
| macros | §19.6 |
2325
| clippy | n/a |
2426
| conversions | n/a |

exercises/error_handling/errors5.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// This exercise uses some concepts that we won't get to until later in the course, like `Box` and the
66
// `From` trait. It's not important to understand them in detail right now, but you can read ahead if you like.
7+
// For now, think of the `Box<dyn ...>` type as an "I want anything that does ???" type, which, given
8+
// Rust's usual standards for runtime safety, should strike you as somewhat lenient!
79

810
// In short, this particular use case for boxes is for when you want to own a value and you care only that it is a
911
// type which implements a particular trait. To do so, The Box is declared as of type Box<dyn Trait> where Trait is the trait

exercises/macros/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ macros. Instead, we'll show you how to use and create them.
77
## Further information
88

99
- [Macros](https://doc.rust-lang.org/book/ch19-06-macros.html)
10-
- [The Little Book of Rust Macros](https://danielkeep.github.io/tlborm/book/index.html)
10+
- [The Little Book of Rust Macros](https://veykril.github.io/tlborm/)

exercises/options/options1.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33

44
// I AM NOT DONE
55

6-
// you can modify anything EXCEPT for this function's signature
7-
fn print_number(maybe_number: Option<u16>) {
8-
println!("printing: {}", maybe_number.unwrap());
9-
}
10-
116
// This function returns how much icecream there is left in the fridge.
127
// If it's before 10PM, there's 5 pieces left. At 10PM, someone eats them
138
// all, so there'll be no more left :(
149
// TODO: Return an Option!
1510
fn maybe_icecream(time_of_day: u16) -> Option<u16> {
1611
// We use the 24-hour system here, so 10PM is a value of 22
12+
// The Option output should gracefully handle cases where time_of_day > 24.
1713
???
1814
}
1915

@@ -23,15 +19,17 @@ mod tests {
2319

2420
#[test]
2521
fn check_icecream() {
26-
assert_eq!(maybe_icecream(10), Some(5));
27-
assert_eq!(maybe_icecream(23), None);
28-
assert_eq!(maybe_icecream(22), None);
22+
assert_eq!(maybe_icecream(9), Some(5));
23+
assert_eq!(maybe_icecream(10), Some(0));
24+
assert_eq!(maybe_icecream(23), Some(0));
25+
assert_eq!(maybe_icecream(22), Some(0));
26+
assert_eq!(maybe_icecream(25), None);
2927
}
3028

3129
#[test]
3230
fn raw_value() {
3331
// TODO: Fix this test. How do you get at the value contained in the Option?
3432
let icecreams = maybe_icecream(12);
35-
assert_eq!(icecreams, 5);
33+
assert_eq!(icecreams, 0);
3634
}
3735
}

exercises/quiz2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ mod my_module {
4242

4343
#[cfg(test)]
4444
mod tests {
45-
// TODO: What to we have to import to have `transformer` in scope?
45+
// TODO: What do we have to import to have `transformer` in scope?
4646
use ???;
4747
use super::Command;
4848

exercises/standard_library_types/box1.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// elements: the value of the current item and the next item. The last item is a value called `Nil`.
1111
//
1212
// Step 1: use a `Box` in the enum definition to make the code compile
13-
// Step 2: create both empty and non-empty cons lists by replacing `unimplemented!()`
13+
// Step 2: create both empty and non-empty cons lists by replacing `todo!()`
1414
//
1515
// Note: the tests should not be changed
1616
//
@@ -33,11 +33,11 @@ fn main() {
3333
}
3434

3535
pub fn create_empty_list() -> List {
36-
unimplemented!()
36+
todo!()
3737
}
3838

3939
pub fn create_non_empty_list() -> List {
40-
unimplemented!()
40+
todo!()
4141
}
4242

4343
#[cfg(test)]

0 commit comments

Comments
 (0)