mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
Adjust AsRef impl for Cow
The existing impl had the too-strong requirement of `Clone`, when only `ToOwned` was needed.
This commit is contained in:
@@ -342,7 +342,7 @@ fn into_cow(self) -> Cow<'a, B> {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T: Clone> AsRef<T> for Cow<'a, T> {
|
||||
impl<'a, T: ?Sized + ToOwned> AsRef<T> for Cow<'a, T> {
|
||||
fn as_ref(&self) -> &T {
|
||||
self
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user