@@ -1093,13 +1093,15 @@ impl Attribute {
1093
1093
}
1094
1094
1095
1095
impl AttributeExt for Attribute {
1096
+ #[ inline]
1096
1097
fn id ( & self ) -> AttrId {
1097
1098
match & self {
1098
1099
Attribute :: Unparsed ( u) => u. id . attr_id ,
1099
1100
_ => panic ! ( ) ,
1100
1101
}
1101
1102
}
1102
1103
1104
+ #[ inline]
1103
1105
fn meta_item_list ( & self ) -> Option < ThinVec < ast:: MetaItemInner > > {
1104
1106
match & self {
1105
1107
Attribute :: Unparsed ( n) => match n. as_ref ( ) {
@@ -1112,15 +1114,18 @@ impl AttributeExt for Attribute {
1112
1114
}
1113
1115
}
1114
1116
1117
+ #[ inline]
1115
1118
fn value_str ( & self ) -> Option < Symbol > {
1116
1119
self . value_lit ( ) . and_then ( |x| x. value_str ( ) )
1117
1120
}
1118
1121
1122
+ #[ inline]
1119
1123
fn value_span ( & self ) -> Option < Span > {
1120
1124
self . value_lit ( ) . map ( |i| i. span )
1121
1125
}
1122
1126
1123
1127
/// For a single-segment attribute, returns its name; otherwise, returns `None`.
1128
+ #[ inline]
1124
1129
fn ident ( & self ) -> Option < Ident > {
1125
1130
match & self {
1126
1131
Attribute :: Unparsed ( n) => {
@@ -1134,6 +1139,7 @@ impl AttributeExt for Attribute {
1134
1139
}
1135
1140
}
1136
1141
1142
+ #[ inline]
1137
1143
fn path_matches ( & self , name : & [ Symbol ] ) -> bool {
1138
1144
match & self {
1139
1145
Attribute :: Unparsed ( n) => {
@@ -1144,11 +1150,12 @@ impl AttributeExt for Attribute {
1144
1150
}
1145
1151
}
1146
1152
1153
+ #[ inline]
1147
1154
fn is_doc_comment ( & self ) -> bool {
1148
- // FIXME(jdonszelmann): make the 2nd check unnecessary here
1149
1155
matches ! ( self , Attribute :: Parsed ( AttributeKind :: DocComment { .. } ) )
1150
1156
}
1151
1157
1158
+ #[ inline]
1152
1159
fn span ( & self ) -> Span {
1153
1160
match & self {
1154
1161
Attribute :: Unparsed ( u) => u. span ,
@@ -1159,6 +1166,7 @@ impl AttributeExt for Attribute {
1159
1166
}
1160
1167
}
1161
1168
1169
+ #[ inline]
1162
1170
fn is_word ( & self ) -> bool {
1163
1171
match & self {
1164
1172
Attribute :: Unparsed ( n) => {
@@ -1168,20 +1176,23 @@ impl AttributeExt for Attribute {
1168
1176
}
1169
1177
}
1170
1178
1179
+ #[ inline]
1171
1180
fn ident_path ( & self ) -> Option < SmallVec < [ Ident ; 1 ] > > {
1172
1181
match & self {
1173
1182
Attribute :: Unparsed ( n) => Some ( n. path . segments . iter ( ) . copied ( ) . collect ( ) ) ,
1174
1183
_ => None ,
1175
1184
}
1176
1185
}
1177
1186
1187
+ #[ inline]
1178
1188
fn doc_str ( & self ) -> Option < Symbol > {
1179
1189
match & self {
1180
1190
Attribute :: Parsed ( AttributeKind :: DocComment { comment, .. } ) => Some ( * comment) ,
1181
1191
Attribute :: Unparsed ( _) if self . has_name ( sym:: doc) => self . value_str ( ) ,
1182
1192
_ => None ,
1183
1193
}
1184
1194
}
1195
+ #[ inline]
1185
1196
fn doc_str_and_comment_kind ( & self ) -> Option < ( Symbol , CommentKind ) > {
1186
1197
match & self {
1187
1198
Attribute :: Parsed ( AttributeKind :: DocComment { kind, comment, .. } ) => {
@@ -1194,6 +1205,7 @@ impl AttributeExt for Attribute {
1194
1205
}
1195
1206
}
1196
1207
1208
+ #[ inline]
1197
1209
fn style ( & self ) -> AttrStyle {
1198
1210
match & self {
1199
1211
Attribute :: Unparsed ( u) => u. style ,
@@ -1205,34 +1217,42 @@ impl AttributeExt for Attribute {
1205
1217
1206
1218
// FIXME(fn_delegation): use function delegation instead of manually forwarding
1207
1219
impl Attribute {
1220
+ #[ inline]
1208
1221
pub fn id ( & self ) -> AttrId {
1209
1222
AttributeExt :: id ( self )
1210
1223
}
1211
1224
1225
+ #[ inline]
1212
1226
pub fn name_or_empty ( & self ) -> Symbol {
1213
1227
AttributeExt :: name_or_empty ( self )
1214
1228
}
1215
1229
1230
+ #[ inline]
1216
1231
pub fn meta_item_list ( & self ) -> Option < ThinVec < MetaItemInner > > {
1217
1232
AttributeExt :: meta_item_list ( self )
1218
1233
}
1219
1234
1235
+ #[ inline]
1220
1236
pub fn value_str ( & self ) -> Option < Symbol > {
1221
1237
AttributeExt :: value_str ( self )
1222
1238
}
1223
1239
1240
+ #[ inline]
1224
1241
pub fn value_span ( & self ) -> Option < Span > {
1225
1242
AttributeExt :: value_span ( self )
1226
1243
}
1227
1244
1245
+ #[ inline]
1228
1246
pub fn ident ( & self ) -> Option < Ident > {
1229
1247
AttributeExt :: ident ( self )
1230
1248
}
1231
1249
1250
+ #[ inline]
1232
1251
pub fn path_matches ( & self , name : & [ Symbol ] ) -> bool {
1233
1252
AttributeExt :: path_matches ( self , name)
1234
1253
}
1235
1254
1255
+ #[ inline]
1236
1256
pub fn is_doc_comment ( & self ) -> bool {
1237
1257
AttributeExt :: is_doc_comment ( self )
1238
1258
}
@@ -1242,34 +1262,42 @@ impl Attribute {
1242
1262
AttributeExt :: has_name ( self , name)
1243
1263
}
1244
1264
1265
+ #[ inline]
1245
1266
pub fn span ( & self ) -> Span {
1246
1267
AttributeExt :: span ( self )
1247
1268
}
1248
1269
1270
+ #[ inline]
1249
1271
pub fn is_word ( & self ) -> bool {
1250
1272
AttributeExt :: is_word ( self )
1251
1273
}
1252
1274
1275
+ #[ inline]
1253
1276
pub fn path ( & self ) -> SmallVec < [ Symbol ; 1 ] > {
1254
1277
AttributeExt :: path ( self )
1255
1278
}
1256
1279
1280
+ #[ inline]
1257
1281
pub fn ident_path ( & self ) -> Option < SmallVec < [ Ident ; 1 ] > > {
1258
1282
AttributeExt :: ident_path ( self )
1259
1283
}
1260
1284
1285
+ #[ inline]
1261
1286
pub fn doc_str ( & self ) -> Option < Symbol > {
1262
1287
AttributeExt :: doc_str ( self )
1263
1288
}
1264
1289
1290
+ #[ inline]
1265
1291
pub fn is_proc_macro_attr ( & self ) -> bool {
1266
1292
AttributeExt :: is_proc_macro_attr ( self )
1267
1293
}
1268
1294
1295
+ #[ inline]
1269
1296
pub fn doc_str_and_comment_kind ( & self ) -> Option < ( Symbol , CommentKind ) > {
1270
1297
AttributeExt :: doc_str_and_comment_kind ( self )
1271
1298
}
1272
1299
1300
+ #[ inline]
1273
1301
pub fn style ( & self ) -> AttrStyle {
1274
1302
AttributeExt :: style ( self )
1275
1303
}
0 commit comments