File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -251,19 +251,18 @@ impl Attrs {
251
251
let enum_ = & item_tree[ loc. id . value ] ;
252
252
253
253
let cfg_options = & crate_graph[ krate] . cfg_options ;
254
- let mut idx = 0 ;
255
- let Some ( variant) = enum_. variants . clone ( ) . find ( |variant| {
254
+
255
+ let Some ( variant) = enum_. variants . clone ( ) . filter ( |variant| {
256
256
let attrs = item_tree. attrs ( db, krate, ( * variant) . into ( ) ) ;
257
- if attrs. is_cfg_enabled ( cfg_options) {
258
- if it. local_id == Idx :: from_raw ( RawIdx :: from ( idx) ) {
259
- return true
260
- }
261
- idx += 1 ;
262
- }
263
- false
264
- } ) else {
257
+ attrs. is_cfg_enabled ( cfg_options)
258
+ } )
259
+ . zip ( 0u32 ..)
260
+ . find ( |( _variant, idx) | it. local_id == Idx :: from_raw ( RawIdx :: from ( * idx) ) )
261
+ . map ( |( variant, _idx) | variant)
262
+ else {
265
263
return Arc :: new ( res) ;
266
264
} ;
265
+
267
266
( item_tree[ variant] . fields . clone ( ) , item_tree, krate)
268
267
}
269
268
VariantId :: StructId ( it) => {
You can’t perform that action at this time.
0 commit comments