From a0a06232ce30ff7ec52367033865cad9cac6ae76 Mon Sep 17 00:00:00 2001 From: John Mendelewski III Date: Sun, 7 Aug 2022 14:51:16 -0400 Subject: [PATCH] fix(traits5): make exercise prefer trait-based solution closes #1088 --- exercises/traits/traits5.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/exercises/traits/traits5.rs b/exercises/traits/traits5.rs index 89174dde..0fbca28a 100644 --- a/exercises/traits/traits5.rs +++ b/exercises/traits/traits5.rs @@ -18,16 +18,20 @@ pub trait OtherTrait { } } -struct SomeStruct { - name: String, -} +struct SomeStruct {} +struct OtherStruct {} impl SomeTrait for SomeStruct {} impl OtherTrait for SomeStruct {} +impl SomeTrait for OtherStruct {} +impl OtherTrait for OtherStruct {} // YOU MAY ONLY CHANGE THE NEXT LINE fn some_func(item: ??) -> bool { item.some_function() && item.other_function() } -fn main() {} +fn main() { + some_func(SomeStruct {}); + some_func(OtherStruct {}); +}