@@ -140,12 +140,7 @@ impl Cfg {
140140 if exclude. contains ( & NameValueCfg :: new ( name) ) {
141141 Ok ( None )
142142 } else {
143- Ok ( Some ( Cfg ( CfgEntry :: NameValue {
144- name,
145- value : None ,
146- name_span : DUMMY_SP ,
147- span : DUMMY_SP ,
148- } ) ) )
143+ Ok ( Some ( Cfg ( CfgEntry :: NameValue { name, value : None , span : DUMMY_SP } ) ) )
149144 }
150145 }
151146 MetaItemKind :: NameValue ( ref lit) => match lit. kind {
@@ -155,8 +150,7 @@ impl Cfg {
155150 } else {
156151 Ok ( Some ( Cfg ( CfgEntry :: NameValue {
157152 name,
158- value : Some ( ( value, DUMMY_SP ) ) ,
159- name_span : DUMMY_SP ,
153+ value : Some ( value) ,
160154 span : DUMMY_SP ,
161155 } ) ) )
162156 }
@@ -226,9 +220,7 @@ impl Cfg {
226220 CfgEntry :: Any ( sub_cfgs, _) => {
227221 sub_cfgs. iter ( ) . any ( |sub_cfg| cfg_matches ( sub_cfg, psess) )
228222 }
229- CfgEntry :: NameValue { name, value, .. } => {
230- psess. config . contains ( & ( * name, value. clone ( ) . map ( |( s, _) | s) ) )
231- }
223+ CfgEntry :: NameValue { name, value, .. } => psess. config . contains ( & ( * name, * value) ) ,
232224 CfgEntry :: Version ( ..) => {
233225 // FIXME: should be handled.
234226 false
@@ -497,7 +489,7 @@ impl Display<'_> {
497489 sub_cfgs
498490 . iter ( )
499491 . map ( |sub_cfg| {
500- if let CfgEntry :: NameValue { value : Some ( ( feat, _ ) ) , .. } = sub_cfg
492+ if let CfgEntry :: NameValue { value : Some ( feat) , .. } = sub_cfg
501493 && short_longhand
502494 {
503495 Either :: Left ( self . code_wrappers ( ) . wrap ( feat) )
@@ -557,7 +549,7 @@ impl fmt::Display for Display<'_> {
557549 ( sym:: unix, None ) => "Unix" ,
558550 ( sym:: windows, None ) => "Windows" ,
559551 ( sym:: debug_assertions, None ) => "debug-assertions enabled" ,
560- ( sym:: target_os, Some ( ( os , _ ) ) ) => match os. as_str ( ) {
552+ ( sym:: target_os, Some ( os ) ) => match os. as_str ( ) {
561553 "android" => "Android" ,
562554 "cygwin" => "Cygwin" ,
563555 "dragonfly" => "DragonFly BSD" ,
@@ -582,7 +574,7 @@ impl fmt::Display for Display<'_> {
582574 "visionos" => "visionOS" ,
583575 _ => "" ,
584576 } ,
585- ( sym:: target_arch, Some ( ( arch, _ ) ) ) => match arch. as_str ( ) {
577+ ( sym:: target_arch, Some ( arch) ) => match arch. as_str ( ) {
586578 "aarch64" => "AArch64" ,
587579 "arm" => "ARM" ,
588580 "loongarch32" => "LoongArch LA32" ,
@@ -605,14 +597,14 @@ impl fmt::Display for Display<'_> {
605597 "x86_64" => "x86-64" ,
606598 _ => "" ,
607599 } ,
608- ( sym:: target_vendor, Some ( ( vendor, _ ) ) ) => match vendor. as_str ( ) {
600+ ( sym:: target_vendor, Some ( vendor) ) => match vendor. as_str ( ) {
609601 "apple" => "Apple" ,
610602 "pc" => "PC" ,
611603 "sun" => "Sun" ,
612604 "fortanix" => "Fortanix" ,
613605 _ => "" ,
614606 } ,
615- ( sym:: target_env, Some ( ( env, _ ) ) ) => match env. as_str ( ) {
607+ ( sym:: target_env, Some ( env) ) => match env. as_str ( ) {
616608 "gnu" => "GNU" ,
617609 "msvc" => "MSVC" ,
618610 "musl" => "musl" ,
@@ -621,20 +613,20 @@ impl fmt::Display for Display<'_> {
621613 "sgx" => "SGX" ,
622614 _ => "" ,
623615 } ,
624- ( sym:: target_endian, Some ( ( endian, _ ) ) ) => {
616+ ( sym:: target_endian, Some ( endian) ) => {
625617 return write ! ( fmt, "{endian}-endian" ) ;
626618 }
627- ( sym:: target_pointer_width, Some ( ( bits, _ ) ) ) => {
619+ ( sym:: target_pointer_width, Some ( bits) ) => {
628620 return write ! ( fmt, "{bits}-bit" ) ;
629621 }
630- ( sym:: target_feature, Some ( ( feat, _ ) ) ) => match self . 1 {
622+ ( sym:: target_feature, Some ( feat) ) => match self . 1 {
631623 Format :: LongHtml => {
632624 return write ! ( fmt, "target feature <code>{feat}</code>" ) ;
633625 }
634626 Format :: LongPlain => return write ! ( fmt, "target feature `{feat}`" ) ,
635627 Format :: ShortHtml => return write ! ( fmt, "<code>{feat}</code>" ) ,
636628 } ,
637- ( sym:: feature, Some ( ( feat, _ ) ) ) => match self . 1 {
629+ ( sym:: feature, Some ( feat) ) => match self . 1 {
638630 Format :: LongHtml => {
639631 return write ! ( fmt, "crate feature <code>{feat}</code>" ) ;
640632 }
@@ -647,9 +639,7 @@ impl fmt::Display for Display<'_> {
647639 fmt. write_str ( human_readable)
648640 } else {
649641 let value = value
650- . map ( |( v, _) | {
651- fmt:: from_fn ( move |f| write ! ( f, "={}" , self . 1 . escape( v. as_str( ) ) ) )
652- } )
642+ . map ( |v| fmt:: from_fn ( move |f| write ! ( f, "={}" , self . 1 . escape( v. as_str( ) ) ) ) )
653643 . maybe_display ( ) ;
654644 self . code_wrappers ( )
655645 . wrap ( format_args ! ( "{}{value}" , self . 1 . escape( name. as_str( ) ) ) )
@@ -684,9 +674,7 @@ impl NameValueCfg {
684674impl < ' a > From < & ' a CfgEntry > for NameValueCfg {
685675 fn from ( cfg : & ' a CfgEntry ) -> Self {
686676 match cfg {
687- CfgEntry :: NameValue { name, value, .. } => {
688- NameValueCfg { name : * name, value : ( * value) . map ( |( v, _) | v) }
689- }
677+ CfgEntry :: NameValue { name, value, .. } => NameValueCfg { name : * name, value : * value } ,
690678 _ => NameValueCfg { name : sym:: empty, value : None } ,
691679 }
692680 }
@@ -886,8 +874,7 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
886874 for ( feature, _) in features {
887875 cfg_info. current_cfg &= Cfg ( CfgEntry :: NameValue {
888876 name : sym:: target_feature,
889- value : Some ( ( * feature, DUMMY_SP ) ) ,
890- name_span : DUMMY_SP ,
877+ value : Some ( * feature) ,
891878 span : DUMMY_SP ,
892879 } ) ;
893880 }
0 commit comments