Skip to content

Commit 9ed849c

Browse files
authored
Merge pull request #2433 from YangSiJun528/fix-stale-exercise-references
Fix stale exercise references
2 parents 3b7ca44 + 7fc3088 commit 9ed849c

5 files changed

Lines changed: 29 additions & 30 deletions

File tree

exercises/18_iterators/iterators5.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn count_for(map: &HashMap<String, Progress>, value: Progress) -> usize {
2727
// of a `for` loop.
2828
fn count_iterator(map: &HashMap<String, Progress>, value: Progress) -> usize {
2929
// `map` is a hash map with `String` keys and `Progress` values.
30-
// map = { "variables1": Complete, "from_str": None, … }
30+
// map = { "variables1": Complete, "conversions3": None, … }
3131
}
3232

3333
fn count_collection_for(collection: &[HashMap<String, Progress>], value: Progress) -> usize {
@@ -46,7 +46,7 @@ fn count_collection_for(collection: &[HashMap<String, Progress>], value: Progres
4646
// iterator instead of a `for` loop.
4747
fn count_collection_iterator(collection: &[HashMap<String, Progress>], value: Progress) -> usize {
4848
// `collection` is a slice of hash maps.
49-
// collection = [{ "variables1": Complete, "from_str": None, … },
49+
// collection = [{ "variables1": Complete, "conversions3": None, … },
5050
// { "variables2": Complete, … }, … ]
5151
}
5252

@@ -64,10 +64,10 @@ mod tests {
6464
let mut map = HashMap::new();
6565
map.insert(String::from("variables1"), Complete);
6666
map.insert(String::from("functions1"), Complete);
67-
map.insert(String::from("hashmap1"), Complete);
68-
map.insert(String::from("arc1"), Some);
69-
map.insert(String::from("as_ref_mut"), None);
70-
map.insert(String::from("from_str"), None);
67+
map.insert(String::from("hashmaps1"), Complete);
68+
map.insert(String::from("smart_pointers3"), Some);
69+
map.insert(String::from("conversions5"), None);
70+
map.insert(String::from("conversions3"), None);
7171

7272
map
7373
}
@@ -81,8 +81,8 @@ mod tests {
8181
other.insert(String::from("variables2"), Complete);
8282
other.insert(String::from("functions2"), Complete);
8383
other.insert(String::from("if1"), Complete);
84-
other.insert(String::from("from_into"), None);
85-
other.insert(String::from("try_from_into"), None);
84+
other.insert(String::from("conversions2"), None);
85+
other.insert(String::from("conversions4"), None);
8686

8787
vec![map, other]
8888
}

exercises/23_conversions/conversions3.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
// This is similar to the previous `from_into` exercise. But this time, we'll
2-
// implement `FromStr` and return errors instead of falling back to a default
3-
// value. Additionally, upon implementing `FromStr`, you can use the `parse`
4-
// method on strings to generate an object of the implementor type. You can read
5-
// more about it in the documentation:
1+
// In this exercise, we'll implement `FromStr` to convert data stored as a
2+
// string into a structured type. Unlike the `From` trait, the conversion
3+
// expressed by `FromStr` can fail, so it returns a `Result`. Additionally,
4+
// upon implementing `FromStr`, you can use the `parse` method on strings to
5+
// generate an object of the implementor type. You can read more about it in
6+
// the documentation:
67
// https://doc.rust-lang.org/std/str/trait.FromStr.html
78

89
use std::num::ParseIntError;

rustlings-macros/info.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,9 +1186,6 @@ hint = """
11861186
The implementation of `FromStr` should return an `Ok` with a `Person` object,
11871187
or an `Err` with an error if the string is not valid.
11881188
1189-
This is almost like the previous `from_into` exercise, but returning errors
1190-
instead of falling back to a default value.
1191-
11921189
Another hint: You can use the `map_err` method of `Result` with a function or a
11931190
closure to wrap the error from `parse::<u8>`.
11941191

solutions/18_iterators/iterators5.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn count_for(map: &HashMap<String, Progress>, value: Progress) -> usize {
2525

2626
fn count_iterator(map: &HashMap<String, Progress>, value: Progress) -> usize {
2727
// `map` is a hash map with `String` keys and `Progress` values.
28-
// map = { "variables1": Complete, "from_str": None, … }
28+
// map = { "variables1": Complete, "conversions3": None, … }
2929
map.values().filter(|val| **val == value).count()
3030
}
3131

@@ -39,7 +39,7 @@ fn count_collection_for(collection: &[HashMap<String, Progress>], value: Progres
3939

4040
fn count_collection_iterator(collection: &[HashMap<String, Progress>], value: Progress) -> usize {
4141
// `collection` is a slice of hash maps.
42-
// collection = [{ "variables1": Complete, "from_str": None, … },
42+
// collection = [{ "variables1": Complete, "conversions3": None, … },
4343
// { "variables2": Complete, … }, … ]
4444
collection
4545
.iter()
@@ -55,7 +55,7 @@ fn count_collection_iterator_flat(
5555
value: Progress,
5656
) -> usize {
5757
// `collection` is a slice of hash maps.
58-
// collection = [{ "variables1": Complete, "from_str": None, … },
58+
// collection = [{ "variables1": Complete, "conversions3": None, … },
5959
// { "variables2": Complete, … }, … ]
6060
collection
6161
.iter()
@@ -77,10 +77,10 @@ mod tests {
7777
let mut map = HashMap::new();
7878
map.insert(String::from("variables1"), Complete);
7979
map.insert(String::from("functions1"), Complete);
80-
map.insert(String::from("hashmap1"), Complete);
81-
map.insert(String::from("arc1"), Some);
82-
map.insert(String::from("as_ref_mut"), None);
83-
map.insert(String::from("from_str"), None);
80+
map.insert(String::from("hashmaps1"), Complete);
81+
map.insert(String::from("smart_pointers3"), Some);
82+
map.insert(String::from("conversions5"), None);
83+
map.insert(String::from("conversions3"), None);
8484

8585
map
8686
}
@@ -92,8 +92,8 @@ mod tests {
9292
other.insert(String::from("variables2"), Complete);
9393
other.insert(String::from("functions2"), Complete);
9494
other.insert(String::from("if1"), Complete);
95-
other.insert(String::from("from_into"), None);
96-
other.insert(String::from("try_from_into"), None);
95+
other.insert(String::from("conversions2"), None);
96+
other.insert(String::from("conversions4"), None);
9797

9898
vec![map, other]
9999
}

solutions/23_conversions/conversions3.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
// This is similar to the previous `from_into` exercise. But this time, we'll
2-
// implement `FromStr` and return errors instead of falling back to a default
3-
// value. Additionally, upon implementing `FromStr`, you can use the `parse`
4-
// method on strings to generate an object of the implementor type. You can read
5-
// more about it in the documentation:
1+
// In this exercise, we'll implement `FromStr` to convert data stored as a
2+
// string into a structured type. Unlike the `From` trait, the conversion
3+
// expressed by `FromStr` can fail, so it returns a `Result`. Additionally,
4+
// upon implementing `FromStr`, you can use the `parse` method on strings to
5+
// generate an object of the implementor type. You can read more about it in
6+
// the documentation:
67
// https://doc.rust-lang.org/std/str/trait.FromStr.html
78

89
use std::num::ParseIntError;

0 commit comments

Comments
 (0)