mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 13:19:18 +00:00
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.
This commit is contained in:
parent
c5898ac6b7
commit
c0dd85ac0b
@ -33,7 +33,7 @@ mod tests {
|
|||||||
let some_software = SomeSoftware {};
|
let some_software = SomeSoftware {};
|
||||||
let other_software = OtherSoftware {};
|
let other_software = OtherSoftware {};
|
||||||
|
|
||||||
assert!(compare_license_types(some_software, other_software));
|
assert!(compare_license_types(&some_software, &other_software));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -41,6 +41,6 @@ mod tests {
|
|||||||
let some_software = SomeSoftware {};
|
let some_software = SomeSoftware {};
|
||||||
let other_software = OtherSoftware {};
|
let other_software = OtherSoftware {};
|
||||||
|
|
||||||
assert!(compare_license_types(other_software, some_software));
|
assert!(compare_license_types(&other_software, &some_software));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user