From cc6a14104d7c034eadc98297eaaa972d09c50b1f Mon Sep 17 00:00:00 2001 From: Brian Kung Date: Thu, 20 Jun 2019 09:45:53 -0500 Subject: [PATCH] Fixes the irrefutable let pattern warning --- exercises/structs/structs1.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/exercises/structs/structs1.rs b/exercises/structs/structs1.rs index e6c378f9..870236df 100644 --- a/exercises/structs/structs1.rs +++ b/exercises/structs/structs1.rs @@ -7,7 +7,8 @@ struct ColorClassicStruct { struct ColorTupleStruct(/* TODO: Something goes here */); -struct ColorUnitStruct; +#[derive(Debug)] +struct UnitStruct; #[cfg(test)] mod tests { @@ -35,12 +36,9 @@ mod tests { #[test] fn unit_structs() { // TODO: Instantiate a unit struct! - // let green = + // let unit_struct = + let message = format!("{:?}s are fun!", unit_struct); - if let ColorUnitStruct = green { - assert!(true); - } else { - assert!(false); - } + assert_eq!(message, "UnitStructs are fun!"); } }