summaryrefslogtreecommitdiff
path: root/exercises
diff options
context:
space:
mode:
Diffstat (limited to 'exercises')
-rw-r--r--exercises/11_hashmaps/hashmaps3.rs9
-rw-r--r--exercises/23_conversions/from_into.rs16
2 files changed, 13 insertions, 12 deletions
diff --git a/exercises/11_hashmaps/hashmaps3.rs b/exercises/11_hashmaps/hashmaps3.rs
index 36544ee..8d9236d 100644
--- a/exercises/11_hashmaps/hashmaps3.rs
+++ b/exercises/11_hashmaps/hashmaps3.rs
@@ -4,10 +4,11 @@
// the form : "<team_1_name>,<team_2_name>,<team_1_goals>,<team_2_goals>"
// Example: England,France,4,2 (England scored 4 goals, France 2).
//
-// You have to build a scores table containing the name of the team, goals the
-// team scored, and goals the team conceded. One approach to build the scores
-// table is to use a Hashmap. The solution is partially written to use a
-// Hashmap, complete it to pass the test.
+// You have to build a scores table containing the name of the team, the total
+// number of goals the team scored, and the total number of goals the team
+// conceded. One approach to build the scores table is to use a Hashmap.
+// The solution is partially written to use a Hashmap,
+// complete it to pass the test.
//
// Make me pass the tests!
//
diff --git a/exercises/23_conversions/from_into.rs b/exercises/23_conversions/from_into.rs
index 00f8c2f..11787c3 100644
--- a/exercises/23_conversions/from_into.rs
+++ b/exercises/23_conversions/from_into.rs
@@ -24,7 +24,8 @@ impl Default for Person {
}
}
-// Your task is to complete this implementation in order for the line `let p =
+
+// Your task is to complete this implementation in order for the line `let p1 =
// Person::from("Mark,20")` to compile. Please note that you'll need to parse the
// age component into a `usize` with something like `"4".parse::<usize>()`. The
// outcome of this needs to be handled appropriately.
@@ -43,8 +44,7 @@ impl Default for Person {
// I AM NOT DONE
impl From<&str> for Person {
- fn from(s: &str) -> Person {
- }
+ fn from(s: &str) -> Person {}
}
fn main() {
@@ -127,14 +127,14 @@ mod tests {
#[test]
fn test_trailing_comma() {
let p: Person = Person::from("Mike,32,");
- assert_eq!(p.name, "Mike");
- assert_eq!(p.age, 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, "Mike");
- assert_eq!(p.age, 32);
+ let p: Person = Person::from("Mike,32,dog");
+ assert_eq!(p.name, "John");
+ assert_eq!(p.age, 30);
}
}