1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-12-12 11:14:55 +02:00

fix(traits5): make exercise prefer trait-based solution

closes #1088
This commit is contained in:
John Mendelewski III 2022-08-07 14:51:16 -04:00
parent 300cdc27dd
commit a0a06232ce

View File

@ -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 {});
}