diff --git a/REVISITS.md b/REVISITS.md index 3074a2d2..9b5116e3 100644 --- a/REVISITS.md +++ b/REVISITS.md @@ -22,4 +22,5 @@ return results to new Vec vector 21) Revisit error6 => HARD 22) trait3 -> very important for understanding default implementation and overrides. Also reread this page: https://doc.rust-lang.org/book/ch10-02-traits.html#default-implementations. Answer also here: https://users.rust-lang.org/t/rustlings-traits3-rs-question/80742/3 25) trait5 -> important to understand trait bounds with generics. Also be sure to understand the short format vs. clearer format and pros/cons +26) Retake quiz3 for more traits+generics practice diff --git a/exercises/quiz3.rs b/exercises/quiz3.rs index 15dc4699..87693b60 100644 --- a/exercises/quiz3.rs +++ b/exercises/quiz3.rs @@ -14,15 +14,15 @@ // Execute `rustlings hint quiz3` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE +use std::fmt::Display as Display; -pub struct ReportCard { - pub grade: f32, +pub struct ReportCard { + pub grade: T, pub student_name: String, pub student_age: u8, } -impl ReportCard { +impl ReportCard { pub fn print(&self) -> String { format!("{} ({}) - achieved a grade of {}", &self.student_name, &self.student_age, &self.grade) @@ -50,7 +50,7 @@ mod tests { fn generate_alphabetic_report_card() { // TODO: Make sure to change the grade here after you finish the exercise. let report_card = ReportCard { - grade: 2.1, + grade: "A+", student_name: "Gary Plotter".to_string(), student_age: 11, }; diff --git a/exercises/tests/tests1.rs b/exercises/tests/tests1.rs index 8b6ea374..abbd1e92 100644 --- a/exercises/tests/tests1.rs +++ b/exercises/tests/tests1.rs @@ -7,12 +7,10 @@ // pass! Make the test fail! // Execute `rustlings hint tests1` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE - #[cfg(test)] mod tests { #[test] fn you_can_assert() { - assert!(); + assert!(true, true); } }