@@ -193,7 +193,7 @@ impl<'a> LintLevelsBuilder<'a> {
193
193
struct_span_err ! ( sess, span, E0452 , "malformed lint attribute" )
194
194
} ;
195
195
for attr in attrs {
196
- let level = match Level :: from_str ( & attr. name ( ) . as_str ( ) ) {
196
+ let level = match attr. ident_str ( ) . and_then ( |name| Level :: from_str ( name ) ) {
197
197
None => continue ,
198
198
Some ( lvl) => lvl,
199
199
} ;
@@ -220,7 +220,7 @@ impl<'a> LintLevelsBuilder<'a> {
220
220
match item. node {
221
221
ast:: MetaItemKind :: Word => { } // actual lint names handled later
222
222
ast:: MetaItemKind :: NameValue ( ref name_value) => {
223
- if item. ident == "reason" {
223
+ if item. path == "reason" {
224
224
// found reason, reslice meta list to exclude it
225
225
metas = & metas[ 0 ..metas. len ( ) -1 ] ;
226
226
// FIXME (#55112): issue unused-attributes lint if we thereby
@@ -254,13 +254,13 @@ impl<'a> LintLevelsBuilder<'a> {
254
254
}
255
255
256
256
for li in metas {
257
- let word = match li. word ( ) {
258
- Some ( word ) => word ,
259
- None => {
260
- let mut err = bad_attr ( li. span ) ;
257
+ let meta_item = match li. meta_item ( ) {
258
+ Some ( meta_item ) if meta_item . is_word ( ) => meta_item ,
259
+ _ => {
260
+ let mut err = bad_attr ( li. span ( ) ) ;
261
261
if let Some ( item) = li. meta_item ( ) {
262
262
if let ast:: MetaItemKind :: NameValue ( _) = item. node {
263
- if item. ident == "reason" {
263
+ if item. path == "reason" {
264
264
err. help ( "reason in lint attribute must come last" ) ;
265
265
}
266
266
}
@@ -269,26 +269,27 @@ impl<'a> LintLevelsBuilder<'a> {
269
269
continue ;
270
270
}
271
271
} ;
272
- let tool_name = if let Some ( lint_tool) = word. is_scoped ( ) {
273
- if !attr:: is_known_lint_tool ( lint_tool) {
272
+ let tool_name = if meta_item. path . segments . len ( ) > 1 {
273
+ let tool_ident = meta_item. path . segments [ 0 ] . ident ;
274
+ if !attr:: is_known_lint_tool ( tool_ident) {
274
275
span_err ! (
275
276
sess,
276
- lint_tool . span,
277
+ tool_ident . span,
277
278
E0710 ,
278
279
"an unknown tool name found in scoped lint: `{}`" ,
279
- word . ident
280
+ meta_item . path
280
281
) ;
281
282
continue ;
282
283
}
283
284
284
- Some ( lint_tool . as_str ( ) )
285
+ Some ( tool_ident . as_str ( ) )
285
286
} else {
286
287
None
287
288
} ;
288
- let name = word . name ( ) ;
289
+ let name = meta_item . path . segments . last ( ) . expect ( "empty lint name" ) . ident . name ;
289
290
match store. check_lint_name ( & name. as_str ( ) , tool_name) {
290
291
CheckLintNameResult :: Ok ( ids) => {
291
- let src = LintSource :: Node ( name, li. span , reason) ;
292
+ let src = LintSource :: Node ( name, li. span ( ) , reason) ;
292
293
for id in ids {
293
294
specs. insert ( * id, ( level, src) ) ;
294
295
}
@@ -299,7 +300,7 @@ impl<'a> LintLevelsBuilder<'a> {
299
300
Ok ( ids) => {
300
301
let complete_name = & format ! ( "{}::{}" , tool_name. unwrap( ) , name) ;
301
302
let src = LintSource :: Node (
302
- Symbol :: intern ( complete_name) , li. span , reason
303
+ Symbol :: intern ( complete_name) , li. span ( ) , reason
303
304
) ;
304
305
for id in ids {
305
306
specs. insert ( * id, ( level, src) ) ;
@@ -321,18 +322,18 @@ impl<'a> LintLevelsBuilder<'a> {
321
322
lint,
322
323
lvl,
323
324
src,
324
- Some ( li. span . into ( ) ) ,
325
+ Some ( li. span ( ) . into ( ) ) ,
325
326
& msg,
326
327
) ;
327
328
err. span_suggestion (
328
- li. span ,
329
+ li. span ( ) ,
329
330
"change it to" ,
330
331
new_lint_name. to_string ( ) ,
331
332
Applicability :: MachineApplicable ,
332
333
) . emit ( ) ;
333
334
334
335
let src = LintSource :: Node (
335
- Symbol :: intern ( & new_lint_name) , li. span , reason
336
+ Symbol :: intern ( & new_lint_name) , li. span ( ) , reason
336
337
) ;
337
338
for id in ids {
338
339
specs. insert ( * id, ( level, src) ) ;
@@ -359,11 +360,11 @@ impl<'a> LintLevelsBuilder<'a> {
359
360
lint,
360
361
level,
361
362
src,
362
- Some ( li. span . into ( ) ) ,
363
+ Some ( li. span ( ) . into ( ) ) ,
363
364
& msg) ;
364
365
if let Some ( new_name) = renamed {
365
366
err. span_suggestion (
366
- li. span ,
367
+ li. span ( ) ,
367
368
"use the new name" ,
368
369
new_name,
369
370
Applicability :: MachineApplicable
@@ -382,12 +383,12 @@ impl<'a> LintLevelsBuilder<'a> {
382
383
lint,
383
384
level,
384
385
src,
385
- Some ( li. span . into ( ) ) ,
386
+ Some ( li. span ( ) . into ( ) ) ,
386
387
& msg) ;
387
388
388
389
if let Some ( suggestion) = suggestion {
389
390
db. span_suggestion (
390
- li. span ,
391
+ li. span ( ) ,
391
392
"did you mean" ,
392
393
suggestion. to_string ( ) ,
393
394
Applicability :: MachineApplicable ,
0 commit comments