From c0dd85ac0ba4fdf2ec3eefa0789b20b47d6454d9 Mon Sep 17 00:00:00 2001 From: Anri Lombard Date: Fri, 6 Jan 2023 16:25:01 +0200 Subject: [PATCH] Correct borrowing The previous code does not allow a good solution by just changing the function parameters, unless I am mistaken. This code allows "&dyn Licensed" to be substituted for "??" and works well. --- exercises/traits/traits4.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/traits/traits4.rs b/exercises/traits/traits4.rs index 6b541665..86f8e933 100644 --- a/exercises/traits/traits4.rs +++ b/exercises/traits/traits4.rs @@ -33,7 +33,7 @@ mod tests { let some_software = SomeSoftware {}; let other_software = OtherSoftware {}; - assert!(compare_license_types(some_software, other_software)); + assert!(compare_license_types(&some_software, &other_software)); } #[test] @@ -41,6 +41,6 @@ mod tests { let some_software = SomeSoftware {}; let other_software = OtherSoftware {}; - assert!(compare_license_types(other_software, some_software)); + assert!(compare_license_types(&other_software, &some_software)); } }