diff options
| author | liv <mokou@fastmail.com> | 2022-08-11 12:30:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-11 12:30:12 +0200 |
| commit | 26b347a8bdfc3a590178ed4d78750ac6a4303f13 (patch) | |
| tree | 3f9776030a484bd16f91d61a9c62512831c0559e /exercises | |
| parent | 3c85fc4d39128ed9720418743b0c8b18031364be (diff) | |
| parent | a0a06232ce30ff7ec52367033865cad9cac6ae76 (diff) | |
Merge pull request #1131 from johnmendel/main
fix(traits5): make exercise prefer trait-based solution
Diffstat (limited to 'exercises')
| -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 {}); +} |
