Skip to content

Commit 52169b9

Browse files
authored
Update traits4.rs
1 parent 98a97d7 commit 52169b9

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

exercises/traits/traits4.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
// traits4.rs
2-
//
3-
// Your task is to replace the '??' sections so the code compiles.
4-
//
5-
// Don't change any line other than the marked one.
6-
//
7-
// Execute `rustlings hint traits4` or use the `hint` watch subcommand for a
8-
// hint.
9-
10-
// I AM NOT DONE
11-
121
pub trait Licensed {
132
fn licensing_info(&self) -> String {
143
"some information".to_string()
@@ -23,7 +12,7 @@ impl Licensed for SomeSoftware {}
2312
impl Licensed for OtherSoftware {}
2413

2514
// YOU MAY ONLY CHANGE THE NEXT LINE
26-
fn compare_license_types(software: ??, software_two: ??) -> bool {
15+
fn compare_license_types(software: &impl Licensed, software_two: &impl Licensed) -> bool {
2716
software.licensing_info() == software_two.licensing_info()
2817
}
2918

@@ -36,14 +25,14 @@ mod tests {
3625
let some_software = SomeSoftware {};
3726
let other_software = OtherSoftware {};
3827

39-
assert!(compare_license_types(some_software, other_software));
28+
assert!(compare_license_types(&some_software, &other_software));
4029
}
4130

4231
#[test]
4332
fn compare_license_information_backwards() {
4433
let some_software = SomeSoftware {};
4534
let other_software = OtherSoftware {};
4635

47-
assert!(compare_license_types(other_software, some_software));
36+
assert!(compare_license_types(&other_software, &some_software));
4837
}
4938
}

0 commit comments

Comments
 (0)