Skip to content

Commit e1704a2

Browse files
authored
Merge branch 'main' into main
2 parents 1e02f19 + 0282da6 commit e1704a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+748
-425
lines changed

.all-contributorsrc

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,69 @@
21362136
"contributions": [
21372137
"content"
21382138
]
2139+
},
2140+
{
2141+
"login": "proofconstruction",
2142+
"name": "proofconstruction",
2143+
"avatar_url": "https://avatars.githubusercontent.com/u/74747193?v=4",
2144+
"profile": "https://github.com/proofconstruction",
2145+
"contributions": [
2146+
"infra"
2147+
]
2148+
},
2149+
{
2150+
"login": "IVIURRAY",
2151+
"name": "IVIURRAY",
2152+
"avatar_url": "https://avatars.githubusercontent.com/u/16007179?v=4",
2153+
"profile": "https://www.youtube.com/channel/UCQCjA6qUutAtWqkCA4Z36CQ",
2154+
"contributions": [
2155+
"content"
2156+
]
2157+
},
2158+
{
2159+
"login": "b-apperlo",
2160+
"name": "Bert Apperlo",
2161+
"avatar_url": "https://avatars.githubusercontent.com/u/91734527?v=4",
2162+
"profile": "https://github.com/b-apperlo",
2163+
"contributions": [
2164+
"content"
2165+
]
2166+
},
2167+
{
2168+
"login": "FWDekker",
2169+
"name": "Florine W. Dekker",
2170+
"avatar_url": "https://avatars.githubusercontent.com/u/13442533?v=4",
2171+
"profile": "https://fwdekker.com/",
2172+
"contributions": [
2173+
"content"
2174+
]
2175+
},
2176+
{
2177+
"login": "luhem7",
2178+
"name": "Mehul Gangavelli",
2179+
"avatar_url": "https://avatars.githubusercontent.com/u/4008215?v=4",
2180+
"profile": "https://github.com/luhem7",
2181+
"contributions": [
2182+
"content"
2183+
]
2184+
},
2185+
{
2186+
"login": "Frosthage",
2187+
"name": "Mikael Frosthage",
2188+
"avatar_url": "https://avatars.githubusercontent.com/u/14823314?v=4",
2189+
"profile": "https://github.com/Frosthage",
2190+
"contributions": [
2191+
"content"
2192+
]
2193+
},
2194+
{
2195+
"login": "robertefry",
2196+
"name": "Robert Fry",
2197+
"avatar_url": "https://avatars.githubusercontent.com/u/43712054?v=4",
2198+
"profile": "https://robertfry.xyz",
2199+
"contributions": [
2200+
"content"
2201+
]
21392202
}
21402203
],
21412204
"contributorsPerLine": 8,
@@ -2144,5 +2207,6 @@
21442207
"repoType": "github",
21452208
"repoHost": "https://github.com",
21462209
"skipCi": true,
2147-
"commitConvention": "angular"
2210+
"commitConvention": "angular",
2211+
"commitType": "docs"
21482212
}

.github/workflows/rust.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v3
17+
- name: Fetch & maybe update Cargo.lock
18+
run: cargo fetch --locked
1719
- name: Build
1820
run: cargo build --verbose
1921
- name: Run tests

AUTHORS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,15 @@ authors.
303303
<tr>
304304
<td align="center" valign="top" width="12.5%"><a href="https://github.com/b1ue64"><img src="https://avatars.githubusercontent.com/u/77976308?v=4?s=100" width="100px;" alt="b1ue64"/><br /><sub><b>b1ue64</b></sub></a><br /><a href="#content-b1ue64" title="Content">🖋</a></td>
305305
<td align="center" valign="top" width="12.5%"><a href="https://github.com/lazywalker"><img src="https://avatars.githubusercontent.com/u/53956?v=4?s=100" width="100px;" alt="lazywalker"/><br /><sub><b>lazywalker</b></sub></a><br /><a href="#content-lazywalker" title="Content">🖋</a></td>
306+
<td align="center" valign="top" width="12.5%"><a href="https://github.com/proofconstruction"><img src="https://avatars.githubusercontent.com/u/74747193?v=4?s=100" width="100px;" alt="proofconstruction"/><br /><sub><b>proofconstruction</b></sub></a><br /><a href="#infra-proofconstruction" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
307+
<td align="center" valign="top" width="12.5%"><a href="https://www.youtube.com/channel/UCQCjA6qUutAtWqkCA4Z36CQ"><img src="https://avatars.githubusercontent.com/u/16007179?v=4?s=100" width="100px;" alt="IVIURRAY"/><br /><sub><b>IVIURRAY</b></sub></a><br /><a href="#content-IVIURRAY" title="Content">🖋</a></td>
308+
<td align="center" valign="top" width="12.5%"><a href="https://github.com/b-apperlo"><img src="https://avatars.githubusercontent.com/u/91734527?v=4?s=100" width="100px;" alt="Bert Apperlo"/><br /><sub><b>Bert Apperlo</b></sub></a><br /><a href="#content-b-apperlo" title="Content">🖋</a></td>
309+
<td align="center" valign="top" width="12.5%"><a href="https://fwdekker.com/"><img src="https://avatars.githubusercontent.com/u/13442533?v=4?s=100" width="100px;" alt="Florine W. Dekker"/><br /><sub><b>Florine W. Dekker</b></sub></a><br /><a href="#content-FWDekker" title="Content">🖋</a></td>
310+
<td align="center" valign="top" width="12.5%"><a href="https://github.com/luhem7"><img src="https://avatars.githubusercontent.com/u/4008215?v=4?s=100" width="100px;" alt="Mehul Gangavelli"/><br /><sub><b>Mehul Gangavelli</b></sub></a><br /><a href="#content-luhem7" title="Content">🖋</a></td>
311+
<td align="center" valign="top" width="12.5%"><a href="https://github.com/Frosthage"><img src="https://avatars.githubusercontent.com/u/14823314?v=4?s=100" width="100px;" alt="Mikael Frosthage"/><br /><sub><b>Mikael Frosthage</b></sub></a><br /><a href="#content-Frosthage" title="Content">🖋</a></td>
312+
</tr>
313+
<tr>
314+
<td align="center" valign="top" width="12.5%"><a href="https://robertfry.xyz"><img src="https://avatars.githubusercontent.com/u/43712054?v=4?s=100" width="100px;" alt="Robert Fry"/><br /><sub><b>Robert Fry</b></sub></a><br /><a href="#content-robertefry" title="Content">🖋</a></td>
306315
</tr>
307316
</tbody>
308317
</table>

exercises/clippy/clippy1.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
// clippy1.rs
2-
// The Clippy tool is a collection of lints to analyze your code
3-
// so you can catch common mistakes and improve your Rust code.
42
//
5-
// For these exercises the code will fail to compile when there are clippy warnings
6-
// check clippy's suggestions from the output to solve the exercise.
7-
// Execute `rustlings hint clippy1` or use the `hint` watch subcommand for a hint.
3+
// The Clippy tool is a collection of lints to analyze your code so you can
4+
// catch common mistakes and improve your Rust code.
5+
//
6+
// For these exercises the code will fail to compile when there are clippy
7+
// warnings check clippy's suggestions from the output to solve the exercise.
8+
//
9+
// Execute `rustlings hint clippy1` or use the `hint` watch subcommand for a
10+
// hint.
811

912
// I AM NOT DONE
1013

exercises/clippy/clippy2.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// clippy2.rs
2-
// Execute `rustlings hint clippy2` or use the `hint` watch subcommand for a hint.
2+
//
3+
// Execute `rustlings hint clippy2` or use the `hint` watch subcommand for a
4+
// hint.
35

46
// I AM NOT DONE
57

exercises/clippy/clippy3.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// clippy3.rs
2+
//
23
// Here's a couple more easy Clippy fixes, so you can see its utility.
4+
//
5+
// Execute `rustlings hint clippy3` or use the `hint` watch subcommand for a hint.
36

47
// I AM NOT DONE
58

exercises/conversions/as_ref_mut.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
// AsRef and AsMut allow for cheap reference-to-reference conversions.
2-
// Read more about them at https://doc.rust-lang.org/std/convert/trait.AsRef.html
3-
// and https://doc.rust-lang.org/std/convert/trait.AsMut.html, respectively.
4-
// Execute `rustlings hint as_ref_mut` or use the `hint` watch subcommand for a hint.
1+
// as_ref_mut.rs
2+
//
3+
// AsRef and AsMut allow for cheap reference-to-reference conversions. Read more
4+
// about them at https://doc.rust-lang.org/std/convert/trait.AsRef.html and
5+
// https://doc.rust-lang.org/std/convert/trait.AsMut.html, respectively.
6+
//
7+
// Execute `rustlings hint as_ref_mut` or use the `hint` watch subcommand for a
8+
// hint.
59

610
// I AM NOT DONE
711

exercises/conversions/from_into.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
// The From trait is used for value-to-value conversions.
2-
// If From is implemented correctly for a type, the Into trait should work conversely.
3-
// You can read more about it at https://doc.rust-lang.org/std/convert/trait.From.html
4-
// Execute `rustlings hint from_into` or use the `hint` watch subcommand for a hint.
1+
// from_into.rs
2+
//
3+
// The From trait is used for value-to-value conversions. If From is implemented
4+
// correctly for a type, the Into trait should work conversely. You can read
5+
// more about it at https://doc.rust-lang.org/std/convert/trait.From.html
6+
//
7+
// Execute `rustlings hint from_into` or use the `hint` watch subcommand for a
8+
// hint.
59

610
#[derive(Debug)]
711
struct Person {
@@ -20,20 +24,21 @@ impl Default for Person {
2024
}
2125
}
2226

23-
// Your task is to complete this implementation
24-
// in order for the line `let p = Person::from("Mark,20")` to compile
25-
// Please note that you'll need to parse the age component into a `usize`
26-
// with something like `"4".parse::<usize>()`. The outcome of this needs to
27-
// be handled appropriately.
27+
// Your task is to complete this implementation in order for the line `let p =
28+
// Person::from("Mark,20")` to compile Please note that you'll need to parse the
29+
// age component into a `usize` with something like `"4".parse::<usize>()`. The
30+
// outcome of this needs to be handled appropriately.
2831
//
2932
// Steps:
30-
// 1. If the length of the provided string is 0, then return the default of Person
31-
// 2. Split the given string on the commas present in it
32-
// 3. Extract the first element from the split operation and use it as the name
33-
// 4. If the name is empty, then return the default of Person
34-
// 5. Extract the other element from the split operation and parse it into a `usize` as the age
35-
// If while parsing the age, something goes wrong, then return the default of Person
36-
// Otherwise, then return an instantiated Person object with the results
33+
// 1. If the length of the provided string is 0, then return the default of
34+
// Person.
35+
// 2. Split the given string on the commas present in it.
36+
// 3. Extract the first element from the split operation and use it as the name.
37+
// 4. If the name is empty, then return the default of Person.
38+
// 5. Extract the other element from the split operation and parse it into a
39+
// `usize` as the age.
40+
// If while parsing the age, something goes wrong, then return the default of
41+
// Person Otherwise, then return an instantiated Person object with the results
3742

3843
// I AM NOT DONE
3944

@@ -77,7 +82,8 @@ mod tests {
7782
}
7883
#[test]
7984
fn test_bad_age() {
80-
// Test that "Mark,twenty" will return the default person due to an error in parsing age
85+
// Test that "Mark,twenty" will return the default person due to an
86+
// error in parsing age
8187
let p = Person::from("Mark,twenty");
8288
assert_eq!(p.name, "John");
8389
assert_eq!(p.age, 30);

exercises/conversions/from_str.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
// from_str.rs
2-
// This is similar to from_into.rs, but this time we'll implement `FromStr`
3-
// and return errors instead of falling back to a default value.
4-
// Additionally, upon implementing FromStr, you can use the `parse` method
5-
// on strings to generate an object of the implementor type.
6-
// You can read more about it at https://doc.rust-lang.org/std/str/trait.FromStr.html
7-
// Execute `rustlings hint from_str` or use the `hint` watch subcommand for a hint.
2+
//
3+
// This is similar to from_into.rs, but this time we'll implement `FromStr` and
4+
// return errors instead of falling back to a default value. Additionally, upon
5+
// implementing FromStr, you can use the `parse` method on strings to generate
6+
// an object of the implementor type. You can read more about it at
7+
// https://doc.rust-lang.org/std/str/trait.FromStr.html
8+
//
9+
// Execute `rustlings hint from_str` or use the `hint` watch subcommand for a
10+
// hint.
811

912
use std::num::ParseIntError;
1013
use std::str::FromStr;
@@ -33,15 +36,18 @@ enum ParsePersonError {
3336
// Steps:
3437
// 1. If the length of the provided string is 0, an error should be returned
3538
// 2. Split the given string on the commas present in it
36-
// 3. Only 2 elements should be returned from the split, otherwise return an error
39+
// 3. Only 2 elements should be returned from the split, otherwise return an
40+
// error
3741
// 4. Extract the first element from the split operation and use it as the name
38-
// 5. Extract the other element from the split operation and parse it into a `usize` as the age
39-
// with something like `"4".parse::<usize>()`
40-
// 6. If while extracting the name and the age something goes wrong, an error should be returned
42+
// 5. Extract the other element from the split operation and parse it into a
43+
// `usize` as the age with something like `"4".parse::<usize>()`
44+
// 6. If while extracting the name and the age something goes wrong, an error
45+
// should be returned
4146
// If everything goes well, then return a Result of a Person object
4247
//
43-
// As an aside: `Box<dyn Error>` implements `From<&'_ str>`. This means that if you want to return a
44-
// string error message, you can do so via just using return `Err("my error message".into())`.
48+
// As an aside: `Box<dyn Error>` implements `From<&'_ str>`. This means that if
49+
// you want to return a string error message, you can do so via just using
50+
// return `Err("my error message".into())`.
4551

4652
impl FromStr for Person {
4753
type Err = ParsePersonError;

exercises/conversions/try_from_into.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// try_from_into.rs
2-
// TryFrom is a simple and safe type conversion that may fail in a controlled way under some circumstances.
3-
// Basically, this is the same as From. The main difference is that this should return a Result type
4-
// instead of the target type itself.
5-
// You can read more about it at https://doc.rust-lang.org/std/convert/trait.TryFrom.html
6-
// Execute `rustlings hint try_from_into` or use the `hint` watch subcommand for a hint.
2+
//
3+
// TryFrom is a simple and safe type conversion that may fail in a controlled
4+
// way under some circumstances. Basically, this is the same as From. The main
5+
// difference is that this should return a Result type instead of the target
6+
// type itself. You can read more about it at
7+
// https://doc.rust-lang.org/std/convert/trait.TryFrom.html
8+
//
9+
// Execute `rustlings hint try_from_into` or use the `hint` watch subcommand for
10+
// a hint.
711

812
use std::convert::{TryFrom, TryInto};
913

@@ -25,14 +29,13 @@ enum IntoColorError {
2529

2630
// I AM NOT DONE
2731

28-
// Your task is to complete this implementation
29-
// and return an Ok result of inner type Color.
30-
// You need to create an implementation for a tuple of three integers,
31-
// an array of three integers, and a slice of integers.
32+
// Your task is to complete this implementation and return an Ok result of inner
33+
// type Color. You need to create an implementation for a tuple of three
34+
// integers, an array of three integers, and a slice of integers.
3235
//
33-
// Note that the implementation for tuple and array will be checked at compile time,
34-
// but the slice implementation needs to check the slice length!
35-
// Also note that correct RGB color values must be integers in the 0..=255 range.
36+
// Note that the implementation for tuple and array will be checked at compile
37+
// time, but the slice implementation needs to check the slice length! Also note
38+
// that correct RGB color values must be integers in the 0..=255 range.
3639

3740
// Tuple implementation
3841
impl TryFrom<(i16, i16, i16)> for Color {

0 commit comments

Comments
 (0)