@@ -1061,10 +1061,7 @@ impl Attribute {
10611061
10621062 pub fn value_lit ( & self ) -> Option < & MetaItemLit > {
10631063 match & self . kind {
1064- AttrKind :: Normal ( n) => match n. as_ref ( ) {
1065- AttrItem { args : AttrArgs :: Eq { expr, .. } , .. } => Some ( expr) ,
1066- _ => None ,
1067- } ,
1064+ AttrKind :: Normal ( box AttrItem { args : AttrArgs :: Eq { expr, .. } , .. } ) => Some ( expr) ,
10681065 _ => None ,
10691066 }
10701067 }
@@ -1077,12 +1074,9 @@ impl AttributeExt for Attribute {
10771074
10781075 fn meta_item_list ( & self ) -> Option < ThinVec < ast:: MetaItemInner > > {
10791076 match & self . kind {
1080- AttrKind :: Normal ( n) => match n. as_ref ( ) {
1081- AttrItem { args : AttrArgs :: Delimited ( d) , .. } => {
1082- ast:: MetaItemKind :: list_from_tokens ( d. tokens . clone ( ) )
1083- }
1084- _ => None ,
1085- } ,
1077+ AttrKind :: Normal ( box AttrItem { args : AttrArgs :: Delimited ( d) , .. } ) => {
1078+ ast:: MetaItemKind :: list_from_tokens ( d. tokens . clone ( ) )
1079+ }
10861080 _ => None ,
10871081 }
10881082 }
@@ -1098,14 +1092,10 @@ impl AttributeExt for Attribute {
10981092 /// For a single-segment attribute, returns its name; otherwise, returns `None`.
10991093 fn ident ( & self ) -> Option < Ident > {
11001094 match & self . kind {
1101- AttrKind :: Normal ( n) => {
1102- if let [ ident] = n. path . segments . as_ref ( ) {
1103- Some ( * ident)
1104- } else {
1105- None
1106- }
1107- }
1108- AttrKind :: DocComment ( ..) => None ,
1095+ AttrKind :: Normal ( box AttrItem {
1096+ path : AttrPath { segments : box [ ident] , .. } , ..
1097+ } ) => Some ( * ident) ,
1098+ _ => None ,
11091099 }
11101100 }
11111101
@@ -1128,12 +1118,7 @@ impl AttributeExt for Attribute {
11281118 }
11291119
11301120 fn is_word ( & self ) -> bool {
1131- match & self . kind {
1132- AttrKind :: Normal ( n) => {
1133- matches ! ( n. args, AttrArgs :: Empty )
1134- }
1135- AttrKind :: DocComment ( ..) => false ,
1136- }
1121+ matches ! ( self . kind, AttrKind :: Normal ( box AttrItem { args: AttrArgs :: Empty , .. } ) )
11371122 }
11381123
11391124 fn ident_path ( & self ) -> Option < SmallVec < [ Ident ; 1 ] > > {
0 commit comments