From e9b42bbc2a20df848950375a5baafc0620017a9c Mon Sep 17 00:00:00 2001 From: Will Hayworth Date: Sun, 3 Jan 2021 03:42:39 -0800 Subject: [PATCH 01/10] docs: mention flatten in the options2 hint --- info.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/info.toml b/info.toml index ee4ab2f6..15cd3f3f 100644 --- a/info.toml +++ b/info.toml @@ -583,8 +583,7 @@ https://doc.rust-lang.org/rust-by-example/flow_control/while_let.html Remember that Options can be stacked in if let and while let. For example: Some(Some(variable)) = variable2 - - +Also see Option::flatten """ [[exercises]] From c355ac6593e94e09459dea93a11371f132913123 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 4 Jan 2021 13:12:10 +0000 Subject: [PATCH 02/10] docs: update README.md [skip ci] --- README.md | 146 +++++++++++++++++++++++++++--------------------------- 1 file changed, 74 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 16f8c3d8..b67793d4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![crab pet](https://i.imgur.com/LbZJgmm.gif) -[![All Contributors](https://img.shields.io/badge/all_contributors-70-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-71-orange.svg?style=flat-square)](#contributors-) # rustlings πŸ¦€β€οΈ @@ -169,97 +169,99 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + +

Carol (Nichols || Goulding)

πŸ’» πŸ–‹

QuietMisdreavus

πŸ’» πŸ–‹

Robert M Lugg

πŸ–‹

Hynek Schlawack

πŸ’»

Katharina Fey

πŸ’»

lukabavdaz

πŸ’» πŸ–‹

Erik Vesteraas

πŸ’»

delet0r

πŸ’»

Carol (Nichols || Goulding)

πŸ’» πŸ–‹

QuietMisdreavus

πŸ’» πŸ–‹

Robert M Lugg

πŸ–‹

Hynek Schlawack

πŸ’»

Katharina Fey

πŸ’»

lukabavdaz

πŸ’» πŸ–‹

Erik Vesteraas

πŸ’»

delet0r

πŸ’»

Shaun Bennett

πŸ’»

Andrew Bagshaw

πŸ’»

Kyle Isom

πŸ’»

Colin Pitrat

πŸ’»

Zac Anger

πŸ’»

Matthias Geier

πŸ’»

Chris Pearce

πŸ’»

Yvan Sraka

πŸ’»

Shaun Bennett

πŸ’»

Andrew Bagshaw

πŸ’»

Kyle Isom

πŸ’»

Colin Pitrat

πŸ’»

Zac Anger

πŸ’»

Matthias Geier

πŸ’»

Chris Pearce

πŸ’»

Yvan Sraka

πŸ’»

Denys Smirnov

πŸ’»

eddyp

πŸ’»

Brian Kung

πŸ’» πŸ–‹

Russell

πŸ’»

Dan Wilhelm

πŸ“–

Jesse

πŸ’» πŸ–‹

Fredrik JambrΓ©n

πŸ’»

Pete McFarlane

πŸ–‹

Denys Smirnov

πŸ’»

eddyp

πŸ’»

Brian Kung

πŸ’» πŸ–‹

Russell

πŸ’»

Dan Wilhelm

πŸ“–

Jesse

πŸ’» πŸ–‹

Fredrik JambrΓ©n

πŸ’»

Pete McFarlane

πŸ–‹

nkanderson

πŸ’» πŸ–‹

Ajax M

πŸ“–

Dylan Nugent

πŸ–‹

vyaslav

πŸ’» πŸ–‹

George

πŸ’»

Thomas Holloway

πŸ’» πŸ–‹

Jubilee

πŸ’»

WofWca

πŸ’»

nkanderson

πŸ’» πŸ–‹

Ajax M

πŸ“–

Dylan Nugent

πŸ–‹

vyaslav

πŸ’» πŸ–‹

George

πŸ’»

Thomas Holloway

πŸ’» πŸ–‹

Jubilee

πŸ’»

WofWca

πŸ’»

Roberto Vidal

πŸ’» πŸ“– πŸ€” 🚧

Jens

πŸ“–

Rahat Ahmed

πŸ“–

Abdou Seck

πŸ’» πŸ–‹ πŸ‘€

Katie

πŸ’»

Socrates

πŸ“–

gnodarse

πŸ–‹

Harrison Metzger

πŸ’»

Roberto Vidal

πŸ’» πŸ“– πŸ€” 🚧

Jens

πŸ“–

Rahat Ahmed

πŸ“–

Abdou Seck

πŸ’» πŸ–‹ πŸ‘€

Katie

πŸ’»

Socrates

πŸ“–

gnodarse

πŸ–‹

Harrison Metzger

πŸ’»

Torben Jonas

πŸ’» πŸ–‹

Paul Bissex

πŸ“–

Steven Mann

πŸ’» πŸ–‹

Mario Reder

πŸ’» πŸ–‹

skim

πŸ’»

Sanjay K

πŸ’» πŸ–‹

Rohan Jain

πŸ’»

Said Aspen

πŸ’» πŸ–‹

Torben Jonas

πŸ’» πŸ–‹

Paul Bissex

πŸ“–

Steven Mann

πŸ’» πŸ–‹

Mario Reder

πŸ’» πŸ–‹

skim

πŸ’»

Sanjay K

πŸ’» πŸ–‹

Rohan Jain

πŸ’»

Said Aspen

πŸ’» πŸ–‹

Ufuk Celebi

πŸ’»

lebedevsergey

πŸ“–

Aleksei Trifonov

πŸ–‹

Darren Meehan

πŸ–‹

Jihchi Lee

πŸ–‹

Christofer Bertonha

πŸ–‹

Vivek Bharath Akupatni

πŸ’» ⚠️

DΓ­dac SementΓ© FernΓ‘ndez

πŸ’» πŸ–‹

Ufuk Celebi

πŸ’»

lebedevsergey

πŸ“–

Aleksei Trifonov

πŸ–‹

Darren Meehan

πŸ–‹

Jihchi Lee

πŸ–‹

Christofer Bertonha

πŸ–‹

Vivek Bharath Akupatni

πŸ’» ⚠️

DΓ­dac SementΓ© FernΓ‘ndez

πŸ’» πŸ–‹

Rob Story

πŸ’»

Siobhan Jacobson

πŸ’»

Evan Carroll

πŸ–‹

Jawaad Mahmood

πŸ–‹

Gaurang Tandon

πŸ–‹

Stefan Kupresak

πŸ–‹

Greg Leonard

πŸ–‹

Ryan McQuen

πŸ’»

Rob Story

πŸ’»

Siobhan Jacobson

πŸ’»

Evan Carroll

πŸ–‹

Jawaad Mahmood

πŸ–‹

Gaurang Tandon

πŸ–‹

Stefan Kupresak

πŸ–‹

Greg Leonard

πŸ–‹

Ryan McQuen

πŸ’»

Annika

πŸ‘€

Axel Viala

πŸ’»

Mohammed Sazid Al Rashid

πŸ–‹ πŸ’»

Caleb Webber

🚧

Peter N

🚧

seancad

🚧

Annika

πŸ‘€

Axel Viala

πŸ’»

Mohammed Sazid Al Rashid

πŸ–‹ πŸ’»

Caleb Webber

🚧

Peter N

🚧

seancad

🚧

Will Hayworth

πŸ–‹
- + + This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! From 6df08b411bc09fd10d510be74c80e9cc6164e145 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 4 Jan 2021 13:12:11 +0000 Subject: [PATCH 03/10] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 1549aa45..d2b0fae1 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -655,6 +655,15 @@ "contributions": [ "maintenance" ] + }, + { + "login": "wsh", + "name": "Will Hayworth", + "avatar_url": "https://avatars3.githubusercontent.com/u/181174?v=4", + "profile": "http://willhayworth.com", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From 10965920fbdf8a1efc85bed869e55a1787006404 Mon Sep 17 00:00:00 2001 From: Marius Ungureanu Date: Wed, 6 Jan 2021 11:12:33 +0200 Subject: [PATCH 04/10] fix(move_semantics4): Small readbility improvement (#617) * Small readbility improvement move_semantics4 doc * Remove `an` as it refers to the argument --- exercises/move_semantics/move_semantics4.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/move_semantics/move_semantics4.rs b/exercises/move_semantics/move_semantics4.rs index a1c4a413..6308c296 100644 --- a/exercises/move_semantics/move_semantics4.rs +++ b/exercises/move_semantics/move_semantics4.rs @@ -18,7 +18,7 @@ fn main() { println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1); } -// `fill_vec()` no longer take `vec: Vec` as argument +// `fill_vec()` no longer takes `vec: Vec` as argument fn fill_vec() -> Vec { let mut vec = vec; From 7857b0a689b0847f48d8c14cbd1865e3b812d5ca Mon Sep 17 00:00:00 2001 From: Christian Zeller Date: Wed, 6 Jan 2021 13:47:20 +0100 Subject: [PATCH 05/10] fix(threads1): line number correction --- exercises/threads/threads1.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/threads/threads1.rs b/exercises/threads/threads1.rs index b475b4a1..f31b317e 100644 --- a/exercises/threads/threads1.rs +++ b/exercises/threads/threads1.rs @@ -1,6 +1,6 @@ // threads1.rs // Make this compile! Execute `rustlings hint threads1` for hints :) -// The idea is the thread spawned on line 21 is completing jobs while the main thread is +// The idea is the thread spawned on line 22 is completing jobs while the main thread is // monitoring progress until 10 jobs are completed. Because of the difference between the // spawned threads' sleep time, and the waiting threads sleep time, when you see 6 lines // of "waiting..." and the program ends without timing out when running, From 621816fb561a9501aa15e8c3674ccdff3b2b24fe Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 6 Jan 2021 15:54:33 +0000 Subject: [PATCH 06/10] docs: update README.md [skip ci] --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b67793d4..f489f93d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![crab pet](https://i.imgur.com/LbZJgmm.gif) -[![All Contributors](https://img.shields.io/badge/all_contributors-71-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-72-orange.svg?style=flat-square)](#contributors-) # rustlings πŸ¦€β€οΈ @@ -256,6 +256,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Peter N

🚧
seancad

🚧
Will Hayworth

πŸ–‹ +
Christian Zeller

πŸ–‹ From c24a78ae94b0e8527ee75908edeea136a7a3dbeb Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 6 Jan 2021 15:54:34 +0000 Subject: [PATCH 07/10] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index d2b0fae1..46e68ae5 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -664,6 +664,15 @@ "contributions": [ "content" ] + }, + { + "login": "chrizel", + "name": "Christian Zeller", + "avatar_url": "https://avatars3.githubusercontent.com/u/20802?v=4", + "profile": "https://github.com/chrizel", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From fea86c29d6b0b29513e1cfb56b9eab5d4dcd121e Mon Sep 17 00:00:00 2001 From: fmoko Date: Fri, 8 Jan 2021 14:01:04 +0100 Subject: [PATCH 08/10] chore: Remove Readme GIF --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index f489f93d..987bb839 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -![crab pet](https://i.imgur.com/LbZJgmm.gif) [![All Contributors](https://img.shields.io/badge/all_contributors-72-orange.svg?style=flat-square)](#contributors-) From 5a0521e92c80c43d6451fcc520fd68e7f56106f8 Mon Sep 17 00:00:00 2001 From: Sang-Heon Jeon Date: Sat, 9 Jan 2021 00:07:13 +0900 Subject: [PATCH 09/10] feat(from_str) : add test for checking unnecessary trailing value --- exercises/conversions/from_str.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/exercises/conversions/from_str.rs b/exercises/conversions/from_str.rs index af9eee6d..70ed1796 100644 --- a/exercises/conversions/from_str.rs +++ b/exercises/conversions/from_str.rs @@ -82,4 +82,16 @@ mod tests { fn missing_name_and_invalid_age() { ",one".parse::().unwrap(); } + + #[test] + #[should_panic] + fn trailing_comma() { + "John,32,".parse::().unwrap(); + } + + #[test] + #[should_panic] + fn trailing_comma_and_some_string() { + "John,32,man".parse::().unwrap(); + } } From 4f1374a6e7dd76d0f8769adf51495d5d0f9ea8a1 Mon Sep 17 00:00:00 2001 From: Sang-Heon Jeon Date: Sat, 9 Jan 2021 00:08:38 +0900 Subject: [PATCH 10/10] feat(from_into) : add test for checking unnecessary trailing value --- exercises/conversions/from_into.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/exercises/conversions/from_into.rs b/exercises/conversions/from_into.rs index f24cf61b..9d84174d 100644 --- a/exercises/conversions/from_into.rs +++ b/exercises/conversions/from_into.rs @@ -115,4 +115,18 @@ mod tests { assert_eq!(p.name, "John"); assert_eq!(p.age, 30); } + + #[test] + fn test_trailing_comma() { + let p: Person = Person::from("Mike,32,"); + assert_eq!(p.name, "John"); + assert_eq!(p.age, 30); + } + + #[test] + fn test_trailing_comma_and_some_string() { + let p: Person = Person::from("Mike,32,man"); + assert_eq!(p.name, "John"); + assert_eq!(p.age, 30); + } }