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 {
141141 return ;
142142 }
143143
144- let struct_bools = variant_data
144+ if let Ok ( struct_bools) = variant_data
145145 . fields ( )
146146 . iter ( )
147147 . filter ( |field| is_bool_ty ( & field. ty ) )
148148 . count ( )
149- . try_into ( )
150- . unwrap ( ) ;
151- if self . max_struct_bools < struct_bools {
149+ . try_into ( ) && self . max_struct_bools < struct_bools
150+ {
152151 span_lint_and_help (
153152 cx,
154153 STRUCT_EXCESSIVE_BOOLS ,
155154 item. span ,
156155 & format ! ( "more than {} bools in a struct" , self . max_struct_bools) ,
157156 None ,
158157 "consider using a state machine or refactoring bools into two-variant enums" ,
159- ) ;
160- }
158+ )
159+ }
161160 } ,
162161 ItemKind :: Impl ( box Impl {
163162 of_trait : None , items, ..
You can’t perform that action at this time.
0 commit comments