File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed 
clippy_lints/src/functions Expand file tree Collapse file tree 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(
7575 } 
7676 } ; 
7777
78-  let  ty = cx. typeck_results ( ) . expr_ty ( self_data) ; 
78+  let  ty = cx. typeck_results ( ) . expr_ty_adjusted ( self_data) ; 
7979
8080 let  def = { 
8181 let  mut  kind = ty. kind ( ) ; 
@@ -102,7 +102,7 @@ pub fn check_fn(
102102
103103 let  Some ( used_field)  = used_field else  { 
104104 // 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`  
106106 return ; 
107107 } ; 
108108
Original file line number Diff line number Diff line change @@ -126,5 +126,23 @@ LL | | &mut self.a
126126LL | | }
127127 | |_____^
128128
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
130148
                         You can’t perform that action at this time. 
           
                  
0 commit comments