From b3fbab17918d147ceef3d9658a7c3040fc4b167f Mon Sep 17 00:00:00 2001 From: Rock070 Date: Wed, 3 Jan 2024 00:37:32 +0800 Subject: [PATCH] Refactor some_func to accept a generic type implementing SomeTrait and OtherTrait --- exercises/15_traits/traits5.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exercises/15_traits/traits5.rs b/exercises/15_traits/traits5.rs index df183805..c0474a5d 100644 --- a/exercises/15_traits/traits5.rs +++ b/exercises/15_traits/traits5.rs @@ -7,8 +7,6 @@ // Execute `rustlings hint traits5` or use the `hint` watch subcommand for a // hint. -// I AM NOT DONE - pub trait SomeTrait { fn some_function(&self) -> bool { true @@ -30,7 +28,7 @@ impl SomeTrait for OtherStruct {} impl OtherTrait for OtherStruct {} // YOU MAY ONLY CHANGE THE NEXT LINE -fn some_func(item: ??) -> bool { +fn some_func(item: A) -> bool { item.some_function() && item.other_function() }