Skip to content

Commit db02eaa

Browse files
committed
Update AsRef implementations for Box and Rc to match code style
1 parent f6ac678 commit db02eaa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

library/alloc/src/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@ impl<T: ?Sized, A: Allocator> AsRef<T> for Box<T, A> {
20462046
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
20472047
impl<A: Allocator> AsRef<[u8]> for Box<str, A> {
20482048
fn as_ref(&self) -> &[u8] {
2049-
self.deref().as_ref()
2049+
(&**self).as_ref()
20502050
}
20512051
}
20522052

library/alloc/src/rc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3658,21 +3658,21 @@ impl<T: ?Sized, A: Allocator> AsRef<T> for Rc<T, A> {
36583658
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
36593659
impl<A: Allocator> AsRef<str> for Rc<String, A> {
36603660
fn as_ref(&self) -> &str {
3661-
self.deref().as_ref()
3661+
(&**self).as_ref()
36623662
}
36633663
}
36643664

36653665
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
36663666
impl<A: Allocator> AsRef<[u8]> for Rc<String, A> {
36673667
fn as_ref(&self) -> &[u8] {
3668-
self.deref().as_ref()
3668+
(&**self).as_ref()
36693669
}
36703670
}
36713671

36723672
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
36733673
impl<A: Allocator> AsRef<[u8]> for Rc<str, A> {
36743674
fn as_ref(&self) -> &[u8] {
3675-
self.deref().as_ref()
3675+
(&**self).as_ref()
36763676
}
36773677
}
36783678

0 commit comments

Comments
 (0)