From aea00abd1c24a6793804051f8b48319ed3a2e118 Mon Sep 17 00:00:00 2001 From: Rock070 Date: Sat, 23 Dec 2023 11:31:19 +0800 Subject: [PATCH] Update order creation in structs2.rs --- exercises/07_structs/structs2.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/exercises/07_structs/structs2.rs b/exercises/07_structs/structs2.rs index 328567f0..0ebb2a57 100644 --- a/exercises/07_structs/structs2.rs +++ b/exercises/07_structs/structs2.rs @@ -5,8 +5,6 @@ // Execute `rustlings hint structs2` or use the `hint` watch subcommand for a // hint. -// I AM NOT DONE - #[derive(Debug)] struct Order { name: String, @@ -38,7 +36,12 @@ mod tests { fn your_order() { let order_template = create_order_template(); // TODO: Create your own order using the update syntax and template above! - // let your_order = + let your_order = Order { + name: String::from("Hacker in Rust"), + count: 1, + ..order_template + }; + assert_eq!(your_order.name, "Hacker in Rust"); assert_eq!(your_order.year, order_template.year); assert_eq!(your_order.made_by_phone, order_template.made_by_phone);