diff options
| author | John Mendelewski III <github@jmthree.com> | 2022-08-07 14:51:16 -0400 |
|---|---|---|
| committer | John Mendelewski III <github@jmthree.com> | 2022-08-07 14:51:16 -0400 |
| commit | a0a06232ce30ff7ec52367033865cad9cac6ae76 (patch) | |
| tree | 63e566338aecf7e53ca2af92ff6046815830fdf5 /exercises/traits | |
| parent | 300cdc27dd0eb06939e187f86dd5833d146339a3 (diff) | |
fix(traits5): make exercise prefer trait-based solution
closes #1088
Diffstat (limited to 'exercises/traits')
| -rw-r--r-- | exercises/traits/traits5.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/exercises/traits/traits5.rs b/exercises/traits/traits5.rs index 89174dd..0fbca28 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 {}); +} |
