@@ -144,15 +144,15 @@ impl Cfg {
144144
145145 /// Whether the configuration consists of just `Cfg` or `Not`.
146146 fn is_simple ( & self ) -> bool {
147- match * self {
147+ match self {
148148 Cfg :: False | Cfg :: True | Cfg :: Cfg ( ..) | Cfg :: Not ( ..) => true ,
149149 Cfg :: All ( ..) | Cfg :: Any ( ..) => false ,
150150 }
151151 }
152152
153153 /// Whether the configuration consists of just `Cfg`, `Not` or `All`.
154154 fn is_all ( & self ) -> bool {
155- match * self {
155+ match self {
156156 Cfg :: False | Cfg :: True | Cfg :: Cfg ( ..) | Cfg :: Not ( ..) | Cfg :: All ( ..) => true ,
157157 Cfg :: Any ( ..) => false ,
158158 }
@@ -204,7 +204,7 @@ impl Cfg {
204204 }
205205
206206 fn should_append_only_to_description ( & self ) -> bool {
207- match * self {
207+ match self {
208208 Cfg :: False | Cfg :: True => false ,
209209 Cfg :: Any ( ..) | Cfg :: All ( ..) | Cfg :: Cfg ( ..) => true ,
210210 Cfg :: Not ( box Cfg :: Cfg ( ..) ) => true ,
@@ -261,17 +261,17 @@ impl ops::Not for Cfg {
261261impl ops:: BitAndAssign for Cfg {
262262 fn bitand_assign ( & mut self , other : Cfg ) {
263263 match ( self , other) {
264- ( & mut Cfg :: False , _) | ( _, Cfg :: True ) => { }
264+ ( Cfg :: False , _) | ( _, Cfg :: True ) => { }
265265 ( s, Cfg :: False ) => * s = Cfg :: False ,
266- ( s @ & mut Cfg :: True , b) => * s = b,
267- ( & mut Cfg :: All ( ref mut a) , Cfg :: All ( ref mut b) ) => {
266+ ( s @ Cfg :: True , b) => * s = b,
267+ ( Cfg :: All ( a) , Cfg :: All ( ref mut b) ) => {
268268 for c in b. drain ( ..) {
269269 if !a. contains ( & c) {
270270 a. push ( c) ;
271271 }
272272 }
273273 }
274- ( & mut Cfg :: All ( ref mut a) , ref mut b) => {
274+ ( Cfg :: All ( a) , ref mut b) => {
275275 if !a. contains ( b) {
276276 a. push ( mem:: replace ( b, Cfg :: True ) ) ;
277277 }
@@ -305,15 +305,15 @@ impl ops::BitOrAssign for Cfg {
305305 fn bitor_assign ( & mut self , other : Cfg ) {
306306 match ( self , other) {
307307 ( Cfg :: True , _) | ( _, Cfg :: False ) | ( _, Cfg :: True ) => { }
308- ( s @ & mut Cfg :: False , b) => * s = b,
309- ( & mut Cfg :: Any ( ref mut a) , Cfg :: Any ( ref mut b) ) => {
308+ ( s @ Cfg :: False , b) => * s = b,
309+ ( Cfg :: Any ( a) , Cfg :: Any ( ref mut b) ) => {
310310 for c in b. drain ( ..) {
311311 if !a. contains ( & c) {
312312 a. push ( c) ;
313313 }
314314 }
315315 }
316- ( & mut Cfg :: Any ( ref mut a) , ref mut b) => {
316+ ( Cfg :: Any ( a) , ref mut b) => {
317317 if !a. contains ( b) {
318318 a. push ( mem:: replace ( b, Cfg :: True ) ) ;
319319 }
@@ -440,40 +440,34 @@ impl Display<'_> {
440440
441441impl fmt:: Display for Display < ' _ > {
442442 fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
443- match * self . 0 {
444- Cfg :: Not ( ref child) => match * * child {
445- Cfg :: Any ( ref sub_cfgs) => {
446- let separator =
447- if sub_cfgs. iter ( ) . all ( Cfg :: is_simple) { " nor " } else { ", nor " } ;
448- fmt. write_str ( "neither " ) ?;
449-
450- sub_cfgs
451- . iter ( )
452- . map ( |sub_cfg| {
453- fmt:: from_fn ( |fmt| {
454- write_with_opt_paren (
455- fmt,
456- !sub_cfg. is_all ( ) ,
457- Display ( sub_cfg, self . 1 ) ,
458- )
459- } )
443+ match self . 0 {
444+ Cfg :: Not ( box Cfg :: Any ( sub_cfgs) ) => {
445+ let separator =
446+ if sub_cfgs. iter ( ) . all ( Cfg :: is_simple) { " nor " } else { ", nor " } ;
447+ fmt. write_str ( "neither " ) ?;
448+
449+ sub_cfgs
450+ . iter ( )
451+ . map ( |sub_cfg| {
452+ fmt:: from_fn ( |fmt| {
453+ write_with_opt_paren ( fmt, !sub_cfg. is_all ( ) , Display ( sub_cfg, self . 1 ) )
460454 } )
461- . joined ( separator , fmt )
462- }
463- ref simple @ Cfg :: Cfg ( .. ) => write ! ( fmt , "non-{}" , Display ( simple , self . 1 ) ) ,
464- ref c => write ! ( fmt, "not ({}) " , Display ( c , self . 1 ) ) ,
465- } ,
455+ } )
456+ . joined ( separator , fmt )
457+ }
458+ Cfg :: Not ( box simple @ Cfg :: Cfg ( .. ) ) => write ! ( fmt, "non-{} " , Display ( simple , self . 1 ) ) ,
459+ Cfg :: Not ( box c ) => write ! ( fmt , "not ({})" , Display ( c , self . 1 ) ) ,
466460
467- Cfg :: Any ( ref sub_cfgs) => {
461+ Cfg :: Any ( sub_cfgs) => {
468462 let separator = if sub_cfgs. iter ( ) . all ( Cfg :: is_simple) { " or " } else { ", or " } ;
469463 self . display_sub_cfgs ( fmt, sub_cfgs, separator)
470464 }
471- Cfg :: All ( ref sub_cfgs) => self . display_sub_cfgs ( fmt, sub_cfgs, " and " ) ,
465+ Cfg :: All ( sub_cfgs) => self . display_sub_cfgs ( fmt, sub_cfgs, " and " ) ,
472466
473467 Cfg :: True => fmt. write_str ( "everywhere" ) ,
474468 Cfg :: False => fmt. write_str ( "nowhere" ) ,
475469
476- Cfg :: Cfg ( name, value) => {
470+ & Cfg :: Cfg ( name, value) => {
477471 let human_readable = match ( name, value) {
478472 ( sym:: unix, None ) => "Unix" ,
479473 ( sym:: windows, None ) => "Windows" ,
0 commit comments