Skip to content

Commit d9993cb

Browse files
committed
Remove error when fields use autoderef
1 parent 77374a9 commit d9993cb

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

clippy_lints/src/functions/misnamed_getters.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,14 @@ pub fn check_fn(
101101
}
102102

103103
let Some(used_field) = used_field else {
104-
if cfg!(debug_assertions) {
105-
panic!("Struct doesn't contain the correct field");
106-
} else {
107-
// Don't ICE when possible
108-
return;
109-
}
110-
};
104+
// FIXME: This can be reached if the field access uses autoderef.
105+
// `dec.all_fields()` should be replaced by something that uses autoderef.
106+
return;
107+
};
108+
111109
let Some(correct_field) = correct_field else {
112110
return;
113-
};
111+
};
114112

115113
if cx.tcx.type_of(used_field.did) == cx.tcx.type_of(correct_field.did) {
116114
let left_span = block_expr.span.until(used_ident.span);

0 commit comments

Comments
 (0)