@@ -107,7 +107,7 @@ pub fn is_known(attr: &Attribute) -> bool {
107
107
108
108
impl NestedMetaItem {
109
109
/// Returns the MetaItem if self is a NestedMetaItemKind::MetaItem.
110
- pub fn meta_item ( & self ) -> Option < & P < MetaItem > > {
110
+ pub fn meta_item ( & self ) -> Option < & MetaItem > {
111
111
match self . node {
112
112
NestedMetaItemKind :: MetaItem ( ref item) => Some ( & item) ,
113
113
_ => None
@@ -145,7 +145,7 @@ impl NestedMetaItem {
145
145
}
146
146
147
147
/// Returns a MetaItem if self is a MetaItem with Kind Word.
148
- pub fn word ( & self ) -> Option < & P < MetaItem > > {
148
+ pub fn word ( & self ) -> Option < & MetaItem > {
149
149
self . meta_item ( ) . and_then ( |meta_item| if meta_item. is_word ( ) {
150
150
Some ( meta_item)
151
151
} else {
@@ -294,37 +294,37 @@ impl Attribute {
294
294
295
295
/* Constructors */
296
296
297
- pub fn mk_name_value_item_str ( name : Name , value : InternedString ) -> P < MetaItem > {
297
+ pub fn mk_name_value_item_str ( name : Name , value : InternedString ) -> MetaItem {
298
298
let value_lit = dummy_spanned ( ast:: LitKind :: Str ( value, ast:: StrStyle :: Cooked ) ) ;
299
299
mk_spanned_name_value_item ( DUMMY_SP , name, value_lit)
300
300
}
301
301
302
- pub fn mk_name_value_item ( name : Name , value : ast:: Lit ) -> P < MetaItem > {
302
+ pub fn mk_name_value_item ( name : Name , value : ast:: Lit ) -> MetaItem {
303
303
mk_spanned_name_value_item ( DUMMY_SP , name, value)
304
304
}
305
305
306
- pub fn mk_list_item ( name : Name , items : Vec < NestedMetaItem > ) -> P < MetaItem > {
306
+ pub fn mk_list_item ( name : Name , items : Vec < NestedMetaItem > ) -> MetaItem {
307
307
mk_spanned_list_item ( DUMMY_SP , name, items)
308
308
}
309
309
310
310
pub fn mk_list_word_item ( name : Name ) -> ast:: NestedMetaItem {
311
311
dummy_spanned ( NestedMetaItemKind :: MetaItem ( mk_spanned_word_item ( DUMMY_SP , name) ) )
312
312
}
313
313
314
- pub fn mk_word_item ( name : Name ) -> P < MetaItem > {
314
+ pub fn mk_word_item ( name : Name ) -> MetaItem {
315
315
mk_spanned_word_item ( DUMMY_SP , name)
316
316
}
317
317
318
- pub fn mk_spanned_name_value_item ( sp : Span , name : Name , value : ast:: Lit ) -> P < MetaItem > {
319
- P ( MetaItem { span : sp, name : name, node : MetaItemKind :: NameValue ( value) } )
318
+ pub fn mk_spanned_name_value_item ( sp : Span , name : Name , value : ast:: Lit ) -> MetaItem {
319
+ MetaItem { span : sp, name : name, node : MetaItemKind :: NameValue ( value) }
320
320
}
321
321
322
- pub fn mk_spanned_list_item ( sp : Span , name : Name , items : Vec < NestedMetaItem > ) -> P < MetaItem > {
323
- P ( MetaItem { span : sp, name : name, node : MetaItemKind :: List ( items) } )
322
+ pub fn mk_spanned_list_item ( sp : Span , name : Name , items : Vec < NestedMetaItem > ) -> MetaItem {
323
+ MetaItem { span : sp, name : name, node : MetaItemKind :: List ( items) }
324
324
}
325
325
326
- pub fn mk_spanned_word_item ( sp : Span , name : Name ) -> P < MetaItem > {
327
- P ( MetaItem { span : sp, name : name, node : MetaItemKind :: Word } )
326
+ pub fn mk_spanned_word_item ( sp : Span , name : Name ) -> MetaItem {
327
+ MetaItem { span : sp, name : name, node : MetaItemKind :: Word }
328
328
}
329
329
330
330
@@ -341,12 +341,12 @@ pub fn mk_attr_id() -> AttrId {
341
341
}
342
342
343
343
/// Returns an inner attribute with the given value.
344
- pub fn mk_attr_inner ( id : AttrId , item : P < MetaItem > ) -> Attribute {
344
+ pub fn mk_attr_inner ( id : AttrId , item : MetaItem ) -> Attribute {
345
345
mk_spanned_attr_inner ( DUMMY_SP , id, item)
346
346
}
347
347
348
348
/// Returns an innter attribute with the given value and span.
349
- pub fn mk_spanned_attr_inner ( sp : Span , id : AttrId , item : P < MetaItem > ) -> Attribute {
349
+ pub fn mk_spanned_attr_inner ( sp : Span , id : AttrId , item : MetaItem ) -> Attribute {
350
350
Attribute {
351
351
id : id,
352
352
style : ast:: AttrStyle :: Inner ,
@@ -358,12 +358,12 @@ pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: P<MetaItem>) -> Attribu
358
358
359
359
360
360
/// Returns an outer attribute with the given value.
361
- pub fn mk_attr_outer ( id : AttrId , item : P < MetaItem > ) -> Attribute {
361
+ pub fn mk_attr_outer ( id : AttrId , item : MetaItem ) -> Attribute {
362
362
mk_spanned_attr_outer ( DUMMY_SP , id, item)
363
363
}
364
364
365
365
/// Returns an outer attribute with the given value and span.
366
- pub fn mk_spanned_attr_outer ( sp : Span , id : AttrId , item : P < MetaItem > ) -> Attribute {
366
+ pub fn mk_spanned_attr_outer ( sp : Span , id : AttrId , item : MetaItem ) -> Attribute {
367
367
Attribute {
368
368
id : id,
369
369
style : ast:: AttrStyle :: Outer ,
@@ -373,7 +373,7 @@ pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: P<MetaItem>) -> Attribu
373
373
}
374
374
}
375
375
376
- pub fn mk_doc_attr_outer ( id : AttrId , item : P < MetaItem > , is_sugared_doc : bool ) -> Attribute {
376
+ pub fn mk_doc_attr_outer ( id : AttrId , item : MetaItem , is_sugared_doc : bool ) -> Attribute {
377
377
Attribute {
378
378
id : id,
379
379
style : ast:: AttrStyle :: Outer ,
@@ -390,11 +390,11 @@ pub fn mk_sugared_doc_attr(id: AttrId, text: InternedString, lo: BytePos, hi: By
390
390
Attribute {
391
391
id : id,
392
392
style : style,
393
- value : P ( MetaItem {
393
+ value : MetaItem {
394
394
span : mk_sp ( lo, hi) ,
395
395
name : token:: intern ( "doc" ) ,
396
396
node : MetaItemKind :: NameValue ( lit) ,
397
- } ) ,
397
+ } ,
398
398
is_sugared_doc : true ,
399
399
span : mk_sp ( lo, hi) ,
400
400
}
@@ -423,8 +423,7 @@ pub fn first_attr_value_str_by_name(attrs: &[Attribute], name: &str)
423
423
. and_then ( |at| at. value_str ( ) )
424
424
}
425
425
426
- pub fn last_meta_item_value_str_by_name ( items : & [ P < MetaItem > ] , name : & str )
427
- -> Option < InternedString > {
426
+ pub fn last_meta_item_value_str_by_name ( items : & [ MetaItem ] , name : & str ) -> Option < InternedString > {
428
427
items. iter ( )
429
428
. rev ( )
430
429
. find ( |mi| mi. check_name ( name) )
@@ -859,7 +858,7 @@ pub fn find_deprecation(diagnostic: &Handler, attrs: &[Attribute],
859
858
find_deprecation_generic ( diagnostic, attrs. iter ( ) , item_sp)
860
859
}
861
860
862
- pub fn require_unique_names ( diagnostic : & Handler , metas : & [ P < MetaItem > ] ) {
861
+ pub fn require_unique_names ( diagnostic : & Handler , metas : & [ MetaItem ] ) {
863
862
let mut set = HashSet :: new ( ) ;
864
863
for meta in metas {
865
864
let name = meta. name ( ) ;
0 commit comments