@@ -280,13 +280,12 @@ impl Cfg {
280280
281281 fn should_append_only_to_description ( & self ) -> bool {
282282 match self . 0 {
283- CfgEntry :: Bool ( ..) => false ,
284283 CfgEntry :: Any ( ..)
285284 | CfgEntry :: All ( ..)
286285 | CfgEntry :: NameValue { .. }
287- | CfgEntry :: Version ( ..) => true ,
288- CfgEntry :: Not ( box CfgEntry :: NameValue { .. } , _) => true ,
289- CfgEntry :: Not ( ..) => false ,
286+ | CfgEntry :: Version ( ..)
287+ | CfgEntry :: Not ( box CfgEntry :: NameValue { .. } , _) => true ,
288+ CfgEntry :: Not ( ..) | CfgEntry :: Bool ( .. ) => false ,
290289 }
291290 }
292291
@@ -347,25 +346,25 @@ impl ops::BitAndAssign for Cfg {
347346 ( s @ CfgEntry :: Bool ( true , _) , b) => * s = b,
348347 ( CfgEntry :: All ( a, _) , CfgEntry :: All ( ref mut b, _) ) => {
349348 for c in b. drain ( ..) {
350- if !a. contains ( & c ) {
349+ if !a. iter ( ) . any ( |a| a . is_equivalent_to ( & c ) ) {
351350 a. push ( c) ;
352351 }
353352 }
354353 }
355354 ( CfgEntry :: All ( a, _) , ref mut b) => {
356- if !a. contains ( b ) {
355+ if !a. iter ( ) . any ( |a| a . is_equivalent_to ( b ) ) {
357356 a. push ( mem:: replace ( b, CfgEntry :: Bool ( true , DUMMY_SP ) ) ) ;
358357 }
359358 }
360359 ( s, CfgEntry :: All ( mut a, _) ) => {
361360 let b = mem:: replace ( s, CfgEntry :: Bool ( true , DUMMY_SP ) ) ;
362- if !a. contains ( & b ) {
361+ if !a. iter ( ) . any ( |a| a . is_equivalent_to ( & b ) ) {
363362 a. push ( b) ;
364363 }
365364 * s = CfgEntry :: All ( a, DUMMY_SP ) ;
366365 }
367366 ( s, b) => {
368- if * s != b {
367+ if !s . is_equivalent_to ( & b ) {
369368 let a = mem:: replace ( s, CfgEntry :: Bool ( true , DUMMY_SP ) ) ;
370369 * s = CfgEntry :: All ( thin_vec ! [ a, b] , DUMMY_SP ) ;
371370 }
@@ -391,25 +390,25 @@ impl ops::BitOrAssign for Cfg {
391390 ( s @ CfgEntry :: Bool ( false , _) , b) => * s = b,
392391 ( CfgEntry :: Any ( a, _) , CfgEntry :: Any ( ref mut b, _) ) => {
393392 for c in b. drain ( ..) {
394- if !a. contains ( & c ) {
393+ if !a. iter ( ) . any ( |a| a . is_equivalent_to ( & c ) ) {
395394 a. push ( c) ;
396395 }
397396 }
398397 }
399398 ( CfgEntry :: Any ( a, _) , ref mut b) => {
400- if !a. contains ( b ) {
399+ if !a. iter ( ) . any ( |a| a . is_equivalent_to ( b ) ) {
401400 a. push ( mem:: replace ( b, CfgEntry :: Bool ( true , DUMMY_SP ) ) ) ;
402401 }
403402 }
404403 ( s, CfgEntry :: Any ( mut a, _) ) => {
405404 let b = mem:: replace ( s, CfgEntry :: Bool ( true , DUMMY_SP ) ) ;
406- if !a. contains ( & b ) {
405+ if !a. iter ( ) . any ( |a| a . is_equivalent_to ( & b ) ) {
407406 a. push ( b) ;
408407 }
409408 * s = CfgEntry :: Any ( a, DUMMY_SP ) ;
410409 }
411410 ( s, b) => {
412- if * s != b {
411+ if !s . is_equivalent_to ( & b ) {
413412 let a = mem:: replace ( s, CfgEntry :: Bool ( true , DUMMY_SP ) ) ;
414413 * s = CfgEntry :: Any ( thin_vec ! [ a, b] , DUMMY_SP ) ;
415414 }
@@ -757,6 +756,7 @@ fn handle_auto_cfg_hide_show(
757756 {
758757 for item in items {
759758 // FIXME: Report in case `Cfg::parse` reports an error?
759+
760760 let Ok ( cfg) = Cfg :: parse ( item) else { continue } ;
761761 if let CfgEntry :: NameValue { name, value, .. } = cfg. 0 {
762762 let value = value. map ( |( v, _) | v) ;
0 commit comments