We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ddc4996 commit 81d4590Copy full SHA for 81d4590
clippy_lints/src/functions/missnamed_getters.rs
@@ -83,24 +83,9 @@ pub fn check_fn(
83
}
84
};
85
86
- let variants = def.variants();
87
-
88
- // We're accessing a field, so it should be an union or a struct and have one and only one variant
89
- if variants.len() != 1 {
90
- if cfg!(debug_assertions) {
91
- panic!("Struct or union expected to have only one variant");
92
- } else {
93
- // Don't ICE when possible
94
- return;
95
- }
96
97
98
- let first = variants.last().unwrap();
99
- let fields = &variants[first];
100
101
let mut used_field = None;
102
let mut correct_field = None;
103
- for f in &fields.fields {
+ for f in def.all_fields() {
104
if f.name.as_str() == name {
105
correct_field = Some(f);
106
0 commit comments