Skip to content

Commit 37cdea9

Browse files
committed
Merge branch 'main' into chore/update-hints
2 parents 0ab781c + a7300da commit 37cdea9

File tree

6 files changed

+115
-8
lines changed

6 files changed

+115
-8
lines changed

.all-contributorsrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,6 +2208,33 @@
22082208
"contributions": [
22092209
"content"
22102210
]
2211+
},
2212+
{
2213+
"login": "novanish",
2214+
"name": "Anish",
2215+
"avatar_url": "https://avatars.githubusercontent.com/u/98446102?v=4",
2216+
"profile": "https://anishchhetri.com.np",
2217+
"contributions": [
2218+
"content"
2219+
]
2220+
},
2221+
{
2222+
"login": "vnprc",
2223+
"name": "vnprc",
2224+
"avatar_url": "https://avatars.githubusercontent.com/u/9425366?v=4",
2225+
"profile": "https://github.com/vnprc",
2226+
"contributions": [
2227+
"content"
2228+
]
2229+
},
2230+
{
2231+
"login": "jrcarl624",
2232+
"name": "Joshua Carlson",
2233+
"avatar_url": "https://avatars.githubusercontent.com/u/61999256?v=4",
2234+
"profile": "http://androecia.net",
2235+
"contributions": [
2236+
"content"
2237+
]
22112238
}
22122239
],
22132240
"contributorsPerLine": 8,

AUTHORS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ authors.
313313
<tr>
314314
<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>
315315
<td align="center" valign="top" width="12.5%"><a href="https://github.com/tajo48"><img src="https://avatars.githubusercontent.com/u/55502906?v=4?s=100" width="100px;" alt="tajo48"/><br /><sub><b>tajo48</b></sub></a><br /><a href="#content-tajo48" title="Content">🖋</a></td>
316+
<td align="center" valign="top" width="12.5%"><a href="https://anishchhetri.com.np"><img src="https://avatars.githubusercontent.com/u/98446102?v=4?s=100" width="100px;" alt="Anish"/><br /><sub><b>Anish</b></sub></a><br /><a href="#content-novanish" title="Content">🖋</a></td>
317+
<td align="center" valign="top" width="12.5%"><a href="https://github.com/vnprc"><img src="https://avatars.githubusercontent.com/u/9425366?v=4?s=100" width="100px;" alt="vnprc"/><br /><sub><b>vnprc</b></sub></a><br /><a href="#content-vnprc" title="Content">🖋</a></td>
318+
<td align="center" valign="top" width="12.5%"><a href="http://androecia.net"><img src="https://avatars.githubusercontent.com/u/61999256?v=4?s=100" width="100px;" alt="Joshua Carlson"/><br /><sub><b>Joshua Carlson</b></sub></a><br /><a href="#content-jrcarl624" title="Content">🖋</a></td>
316319
</tr>
317320
</tbody>
318321
</table>

exercises/error_handling/errors1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This function refuses to generate text to be printed on a nametag if you pass
44
// it an empty string. It'd be nicer if it explained what the problem was,
55
// instead of just sometimes returning `None`. Thankfully, Rust has a similar
6-
// construct to `Option` that can be used to express error conditions. Let's use
6+
// construct to `Result` that can be used to express error conditions. Let's use
77
// it!
88
//
99
// Execute `rustlings hint errors1` or use the `hint` watch subcommand for a

exercises/if/if3.rs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// if3.rs
2+
//
3+
// Execute `rustlings hint if3` or use the `hint` watch subcommand for a hint.
4+
5+
// I AM NOT DONE
6+
7+
pub fn animal_habitat(animal: &str) -> &'static str {
8+
let identifier = if animal == "crab" {
9+
1
10+
} else if animal == "gopher" {
11+
2.0
12+
} else if animal == "snake" {
13+
3
14+
} else {
15+
"Unknown"
16+
};
17+
18+
// DO NOT CHANGE THIS STATEMENT BELOW
19+
let habitat = if identifier == 1 {
20+
"Beach"
21+
} else if identifier == 2 {
22+
"Burrow"
23+
} else if identifier == 3 {
24+
"Desert"
25+
} else {
26+
"Unknown"
27+
};
28+
29+
habitat
30+
}
31+
32+
#[cfg(test)]
33+
mod tests {
34+
use super::*;
35+
36+
#[test]
37+
fn gopher_lives_in_burrow() {
38+
assert_eq!(animal_habitat("gopher"), "Burrow")
39+
}
40+
41+
#[test]
42+
fn snake_lives_in_desert() {
43+
assert_eq!(animal_habitat("snake"), "Desert")
44+
}
45+
46+
#[test]
47+
fn crab_lives_on_beach() {
48+
assert_eq!(animal_habitat("crab"), "Beach")
49+
}
50+
51+
#[test]
52+
fn unknown_animal() {
53+
assert_eq!(animal_habitat("dinosaur"), "Unknown")
54+
}
55+
}

info.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ For that first compiler error, it's important in Rust that each conditional
167167
block returns the same type! To get the tests passing, you will need a couple
168168
conditions checking different input values."""
169169

170+
[[exercises]]
171+
name = "if3"
172+
path = "exercises/if/if3.rs"
173+
mode = "test"
174+
hint = """
175+
In Rust, every arm of an `if` expression has to return the same type of value. Make sure the type is consistent across all arms."""
176+
170177
# QUIZ 1
171178

172179
[[exercises]]
@@ -287,7 +294,7 @@ Also: Try accessing `vec0` after having called `fill_vec()`. See what happens!""
287294
[[exercises]]
288295
name = "move_semantics2"
289296
path = "exercises/move_semantics/move_semantics2.rs"
290-
mode = "test"
297+
mode = "compile"
291298
hint = """
292299
When running this exercise for the first time, you'll notice an error about
293300
"borrow of moved value". In Rust, when an argument is passed to a function and

oranda.json

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
{
2-
"homepage": "https://rustlings.cool",
3-
"repository": "https://github.com/rust-lang/rustlings",
4-
"analytics": {
5-
"plausible": {
6-
"domain": "rustlings.cool"
2+
"project": {
3+
"homepage": "https://rustlings.cool",
4+
"repository": "https://github.com/rust-lang/rustlings"
5+
},
6+
"marketing": {
7+
"analytics": {
8+
"plausible": {
9+
"domain": "rustlings.cool"
10+
}
711
}
812
},
9-
"changelog": false
13+
"components": {
14+
"artifacts": {
15+
"cargo_dist": false,
16+
"package_managers": {
17+
"preferred": {
18+
"macos/linux/unix": "curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install.sh | bash",
19+
"windows": "Start-BitsTransfer -Source https://raw.githubusercontent.com/rust-lang/rustlings/main/install.ps1 -Destination $env:TMP/install_rustlings.ps1; Unblock-File $env:TMP/install_rustlings.ps1; Invoke-Expression $env:TMP/install_rustlings.ps1"
20+
}
21+
}
22+
},
23+
"changelog": true
24+
}
1025
}

0 commit comments

Comments
 (0)