@@ -222,9 +222,9 @@ fn find_stability_generic<'a, I>(sess: &ParseSess,
222
222
) +
223
223
for meta in metas {
224
224
if let Some ( mi) = meta. meta_item( ) {
225
- match mi. ident_str ( ) {
225
+ match mi. name_or_empty ( ) . get ( ) {
226
226
$(
227
- Some ( stringify!( $name) )
227
+ stringify!( $name)
228
228
=> if !get( mi, & mut $name) { continue ' outer } ,
229
229
) +
230
230
_ => {
@@ -252,7 +252,7 @@ fn find_stability_generic<'a, I>(sess: &ParseSess,
252
252
}
253
253
}
254
254
255
- match meta. ident_str ( ) . expect ( "not a stability level" ) {
255
+ match meta. name_or_empty ( ) . get ( ) {
256
256
"rustc_deprecated" => {
257
257
if rustc_depr. is_some ( ) {
258
258
span_err ! ( diagnostic, item_sp, E0540 ,
@@ -306,10 +306,10 @@ fn find_stability_generic<'a, I>(sess: &ParseSess,
306
306
let mut issue = None ;
307
307
for meta in metas {
308
308
if let Some ( mi) = meta. meta_item ( ) {
309
- match mi. ident_str ( ) {
310
- Some ( "feature" ) => if !get ( mi, & mut feature) { continue ' outer } ,
311
- Some ( "reason" ) => if !get ( mi, & mut reason) { continue ' outer } ,
312
- Some ( "issue" ) => if !get ( mi, & mut issue) { continue ' outer } ,
309
+ match mi. name_or_empty ( ) . get ( ) {
310
+ "feature" => if !get ( mi, & mut feature) { continue ' outer } ,
311
+ "reason" => if !get ( mi, & mut reason) { continue ' outer } ,
312
+ "issue" => if !get ( mi, & mut issue) { continue ' outer } ,
313
313
_ => {
314
314
handle_errors (
315
315
sess,
@@ -377,10 +377,10 @@ fn find_stability_generic<'a, I>(sess: &ParseSess,
377
377
for meta in metas {
378
378
match meta {
379
379
NestedMetaItem :: MetaItem ( mi) => {
380
- match mi. ident_str ( ) {
381
- Some ( "feature" ) =>
380
+ match mi. name_or_empty ( ) . get ( ) {
381
+ "feature" =>
382
382
if !get ( mi, & mut feature) { continue ' outer } ,
383
- Some ( "since" ) =>
383
+ "since" =>
384
384
if !get ( mi, & mut since) { continue ' outer } ,
385
385
_ => {
386
386
handle_errors (
@@ -532,14 +532,14 @@ pub fn eval_condition<F>(cfg: &ast::MetaItem, sess: &ParseSess, eval: &mut F)
532
532
533
533
// The unwraps below may look dangerous, but we've already asserted
534
534
// that they won't fail with the loop above.
535
- match cfg. ident_str ( ) {
536
- Some ( "any" ) => mis. iter ( ) . any ( |mi| {
535
+ match cfg. name_or_empty ( ) . get ( ) {
536
+ "any" => mis. iter ( ) . any ( |mi| {
537
537
eval_condition ( mi. meta_item ( ) . unwrap ( ) , sess, eval)
538
538
} ) ,
539
- Some ( "all" ) => mis. iter ( ) . all ( |mi| {
539
+ "all" => mis. iter ( ) . all ( |mi| {
540
540
eval_condition ( mi. meta_item ( ) . unwrap ( ) , sess, eval)
541
541
} ) ,
542
- Some ( "not" ) => {
542
+ "not" => {
543
543
if mis. len ( ) != 1 {
544
544
span_err ! ( sess. span_diagnostic, cfg. span, E0536 , "expected 1 cfg-pattern" ) ;
545
545
return false ;
@@ -635,9 +635,9 @@ fn find_deprecation_generic<'a, I>(sess: &ParseSess,
635
635
for meta in list {
636
636
match meta {
637
637
NestedMetaItem :: MetaItem ( mi) => {
638
- match mi. ident_str ( ) {
639
- Some ( "since" ) => if !get ( mi, & mut since) { continue ' outer } ,
640
- Some ( "note" ) => if !get ( mi, & mut note) { continue ' outer } ,
638
+ match mi. name_or_empty ( ) . get ( ) {
639
+ "since" => if !get ( mi, & mut since) { continue ' outer } ,
640
+ "note" => if !get ( mi, & mut note) { continue ' outer } ,
641
641
_ => {
642
642
handle_errors (
643
643
sess,
@@ -729,12 +729,12 @@ pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec<ReprAttr> {
729
729
730
730
let mut recognised = false ;
731
731
if item. is_word ( ) {
732
- let hint = match item. ident_str ( ) {
733
- Some ( "C" ) => Some ( ReprC ) ,
734
- Some ( "packed" ) => Some ( ReprPacked ( 1 ) ) ,
735
- Some ( "simd" ) => Some ( ReprSimd ) ,
736
- Some ( "transparent" ) => Some ( ReprTransparent ) ,
737
- name => name . and_then ( |name| int_type_of_word ( name) ) . map ( ReprInt ) ,
732
+ let hint = match item. name_or_empty ( ) . get ( ) {
733
+ "C" => Some ( ReprC ) ,
734
+ "packed" => Some ( ReprPacked ( 1 ) ) ,
735
+ "simd" => Some ( ReprSimd ) ,
736
+ "transparent" => Some ( ReprTransparent ) ,
737
+ name => int_type_of_word ( name) . map ( ReprInt ) ,
738
738
} ;
739
739
740
740
if let Some ( h) = hint {
0 commit comments