@@ -1061,10 +1061,7 @@ impl Attribute {
1061
1061
1062
1062
pub fn value_lit ( & self ) -> Option < & MetaItemLit > {
1063
1063
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) ,
1068
1065
_ => None ,
1069
1066
}
1070
1067
}
@@ -1077,12 +1074,9 @@ impl AttributeExt for Attribute {
1077
1074
1078
1075
fn meta_item_list ( & self ) -> Option < ThinVec < ast:: MetaItemInner > > {
1079
1076
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
+ }
1086
1080
_ => None ,
1087
1081
}
1088
1082
}
@@ -1098,14 +1092,10 @@ impl AttributeExt for Attribute {
1098
1092
/// For a single-segment attribute, returns its name; otherwise, returns `None`.
1099
1093
fn ident ( & self ) -> Option < Ident > {
1100
1094
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 ,
1109
1099
}
1110
1100
}
1111
1101
@@ -1128,12 +1118,7 @@ impl AttributeExt for Attribute {
1128
1118
}
1129
1119
1130
1120
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 , .. } ) )
1137
1122
}
1138
1123
1139
1124
fn ident_path ( & self ) -> Option < SmallVec < [ Ident ; 1 ] > > {
0 commit comments