File tree 2 files changed +21
-3
lines changed
clippy_lints/src/functions
2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ pub fn check_fn(
75
75
}
76
76
} ;
77
77
78
- let ty = cx. typeck_results ( ) . expr_ty ( self_data) ;
78
+ let ty = cx. typeck_results ( ) . expr_ty_adjusted ( self_data) ;
79
79
80
80
let def = {
81
81
let mut kind = ty. kind ( ) ;
@@ -102,7 +102,7 @@ pub fn check_fn(
102
102
103
103
let Some ( used_field) = used_field else {
104
104
// FIXME: This can be reached if the field access uses autoderef.
105
- // `dec.all_fields()` should be replaced by something that uses autoderef.
105
+ // `dec.all_fields()` should be replaced by something that uses autoderef on the unajusted type of `self_data`
106
106
return ;
107
107
} ;
108
108
Original file line number Diff line number Diff line change @@ -126,5 +126,23 @@ LL | | &mut self.a
126
126
LL | | }
127
127
| |_____^
128
128
129
- error: aborting due to 14 previous errors
129
+ error: getter function appears to return the wrong field
130
+ --> $DIR/misnamed_getters.rs:92:5
131
+ |
132
+ LL | / unsafe fn a(&self) -> &u8 {
133
+ LL | | &self.inner.b
134
+ | | ------------- help: consider using: `&self.inner.a`
135
+ LL | | }
136
+ | |_____^
137
+
138
+ error: getter function appears to return the wrong field
139
+ --> $DIR/misnamed_getters.rs:95:5
140
+ |
141
+ LL | / unsafe fn a_mut(&mut self) -> &mut u8 {
142
+ LL | | &mut self.inner.b
143
+ | | ----------------- help: consider using: `&mut self.inner.a`
144
+ LL | | }
145
+ | |_____^
146
+
147
+ error: aborting due to 16 previous errors
130
148
You can’t perform that action at this time.
0 commit comments