File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -141,23 +141,22 @@ impl EarlyLintPass for ExcessiveBools {
141
141
return ;
142
142
}
143
143
144
- let struct_bools = variant_data
144
+ if let Ok ( struct_bools) = variant_data
145
145
. fields ( )
146
146
. iter ( )
147
147
. filter ( |field| is_bool_ty ( & field. ty ) )
148
148
. count ( )
149
- . try_into ( )
150
- . unwrap ( ) ;
151
- if self . max_struct_bools < struct_bools {
149
+ . try_into ( ) && self . max_struct_bools < struct_bools
150
+ {
152
151
span_lint_and_help (
153
152
cx,
154
153
STRUCT_EXCESSIVE_BOOLS ,
155
154
item. span ,
156
155
& format ! ( "more than {} bools in a struct" , self . max_struct_bools) ,
157
156
None ,
158
157
"consider using a state machine or refactoring bools into two-variant enums" ,
159
- ) ;
160
- }
158
+ )
159
+ }
161
160
} ,
162
161
ItemKind :: Impl ( box Impl {
163
162
of_trait : None , items, ..
You can’t perform that action at this time.
0 commit comments