According to the doc Method-call expressions, receiver type is auto dereferenced in method calls. Based on my tests, this is also the case for free function calls.
Curious if there is official doc on this?
fn print_me(a: &A) {
println!("print_me: {}", a.a);
}
struct A { a: i32 }
trait B { fn print_me(&self) {} }
impl B for A { fn print_me(&self) { println!("A::print_me: {}", self.a) } }
fn main() {
let a = A { a: 17i32 };
let b = &a;
print_me(b);
print_me(&b);
print_me(&&b);
print_me(&&&b);
// print_me(a); // expected `&A`, found struct `A`
a.print_me();
}