Merge pull request #1131 from johnmendel/main

fix(traits5): make exercise prefer trait-based solution
This commit is contained in:
liv 2022-08-11 12:30:12 +02:00 committed by GitHub
commit 26b347a8bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -18,16 +18,20 @@ pub trait OtherTrait {
} }
} }
struct SomeStruct { struct SomeStruct {}
name: String, struct OtherStruct {}
}
impl SomeTrait for SomeStruct {} impl SomeTrait for SomeStruct {}
impl OtherTrait for SomeStruct {} impl OtherTrait for SomeStruct {}
impl SomeTrait for OtherStruct {}
impl OtherTrait for OtherStruct {}
// YOU MAY ONLY CHANGE THE NEXT LINE // YOU MAY ONLY CHANGE THE NEXT LINE
fn some_func(item: ??) -> bool { fn some_func(item: ??) -> bool {
item.some_function() && item.other_function() item.some_function() && item.other_function()
} }
fn main() {} fn main() {
some_func(SomeStruct {});
some_func(OtherStruct {});
}