Skip to content

Commit 083ef45

Browse files
committed
rustc_data_structures deref in a more humane way
1 parent f2b97a8 commit 083ef45

File tree

1 file changed

+12
-12
lines changed
  • compiler/rustc_data_structures/src/owning_ref

1 file changed

+12
-12
lines changed

compiler/rustc_data_structures/src/owning_ref/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -899,25 +899,25 @@ unsafe impl<O, T: ?Sized> StableAddress for OwningRef<O, T> {}
899899

900900
impl<O, T: ?Sized> AsRef<T> for OwningRef<O, T> {
901901
fn as_ref(&self) -> &T {
902-
&*self
902+
self
903903
}
904904
}
905905

906906
impl<O, T: ?Sized> AsRef<T> for OwningRefMut<O, T> {
907907
fn as_ref(&self) -> &T {
908-
&*self
908+
self
909909
}
910910
}
911911

912912
impl<O, T: ?Sized> AsMut<T> for OwningRefMut<O, T> {
913913
fn as_mut(&mut self) -> &mut T {
914-
&mut *self
914+
self
915915
}
916916
}
917917

918918
impl<O, T: ?Sized> Borrow<T> for OwningRef<O, T> {
919919
fn borrow(&self) -> &T {
920-
&*self
920+
self
921921
}
922922
}
923923

@@ -1021,7 +1021,7 @@ where
10211021
T: PartialEq,
10221022
{
10231023
fn eq(&self, other: &Self) -> bool {
1024-
(&*self as &T).eq(&*other as &T)
1024+
self.deref().eq(other.deref())
10251025
}
10261026
}
10271027

@@ -1032,7 +1032,7 @@ where
10321032
T: PartialOrd,
10331033
{
10341034
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
1035-
(&*self as &T).partial_cmp(&*other as &T)
1035+
self.deref().partial_cmp(other.deref())
10361036
}
10371037
}
10381038

@@ -1041,7 +1041,7 @@ where
10411041
T: Ord,
10421042
{
10431043
fn cmp(&self, other: &Self) -> Ordering {
1044-
(&*self as &T).cmp(&*other as &T)
1044+
self.deref().cmp(other.deref())
10451045
}
10461046
}
10471047

@@ -1050,7 +1050,7 @@ where
10501050
T: Hash,
10511051
{
10521052
fn hash<H: Hasher>(&self, state: &mut H) {
1053-
(&*self as &T).hash(state);
1053+
self.deref().hash(state);
10541054
}
10551055
}
10561056

@@ -1059,7 +1059,7 @@ where
10591059
T: PartialEq,
10601060
{
10611061
fn eq(&self, other: &Self) -> bool {
1062-
(&*self as &T).eq(&*other as &T)
1062+
self.deref().eq(other.deref())
10631063
}
10641064
}
10651065

@@ -1070,7 +1070,7 @@ where
10701070
T: PartialOrd,
10711071
{
10721072
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
1073-
(&*self as &T).partial_cmp(&*other as &T)
1073+
self.deref().partial_cmp(other.deref())
10741074
}
10751075
}
10761076

@@ -1079,7 +1079,7 @@ where
10791079
T: Ord,
10801080
{
10811081
fn cmp(&self, other: &Self) -> Ordering {
1082-
(&*self as &T).cmp(&*other as &T)
1082+
self.deref().cmp(other.deref())
10831083
}
10841084
}
10851085

@@ -1088,7 +1088,7 @@ where
10881088
T: Hash,
10891089
{
10901090
fn hash<H: Hasher>(&self, state: &mut H) {
1091-
(&*self as &T).hash(state);
1091+
self.deref().hash(state);
10921092
}
10931093
}
10941094

0 commit comments

Comments
 (0)