Why are the implementations of Borrow<T>
for &T
and &mut T
like this
impl<T: ?Sized> Borrow<T> for &T {
fn borrow(&self) -> &T { &**self }
}
impl<T: ?Sized> Borrow<T> for &mut T {
fn borrow(&self) -> &T { &**self }
}
instead of this?
impl<T: ?Sized> Borrow<T> for &T {
fn borrow(&self) -> &T { *self }
}
impl<T: ?Sized> Borrow<T> for &mut T {
fn borrow(&self) -> &T { *self }
}
It appears to me that these should be the same, and at least the one for &T
seems more natural (the other has an implicit conversion from &mut T
to &T
, right?). Am I missing something? Is it just a matter of preference or there is some difference?