summaryrefslogtreecommitdiff
path: root/exercises/23_conversions
diff options
context:
space:
mode:
Diffstat (limited to 'exercises/23_conversions')
-rw-r--r--exercises/23_conversions/from_into.rs16
1 files changed, 8 insertions, 8 deletions
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);
}
}