Skip to content

Commit

Permalink
Merge pull request rust-lang#1131 from johnmendel/main
Browse files Browse the repository at this point in the history
fix(traits5): make exercise prefer trait-based solution
  • Loading branch information
shadows-withal authored Aug 11, 2022
2 parents 3c85fc4 + a0a0623 commit 26b347a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions exercises/traits/traits5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {});
}

0 comments on commit 26b347a

Please sign in to comment.