Suppose I have some X: Copy
If I write
impl X {
fn foo(???self) { }
}
what is the preferable form of self, &self
or self
? Because the type is Copy
, both would work fine.
The argument for &self
is consistency. The argument for self
is that there are no lifetimes, which can save you from lifetime miselision (In my case, I had X<'f>: Copy
and wanted fn foo(&self) -> Y<'f>
, while lifetime elision has given me fn foo(&'a self) -> Y<'a>
).