mirror of
https://github.com/rust-lang/book.git
synced 2026-09-14 14:30:38 -04:00
Fix normal function call signature
The normal function should not take a reference to an i32, since the inverse function does not take a reference to T. Giving these functions identical call signatures improves clarity, and it makes more sense to pass integers normally than by reference.
This commit is contained in:
@@ -414,7 +414,7 @@ impl ConvertTo<i64> for i32 {
|
||||
}
|
||||
|
||||
// Can be called with T == i32.
|
||||
fn normal<T: ConvertTo<i64>>(x: &T) -> i64 {
|
||||
fn normal<T: ConvertTo<i64>>(x: T) -> i64 {
|
||||
x.convert()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user