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