@@ -194,7 +194,7 @@ impl<'a> LintLevelsBuilder<'a> {
194194 struct_span_err ! ( sess, span, E0452 , "malformed lint attribute" )
195195 } ;
196196 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 ) ) {
198198 None => continue ,
199199 Some ( lvl) => lvl,
200200 } ;
@@ -221,7 +221,7 @@ impl<'a> LintLevelsBuilder<'a> {
221221 match item. node {
222222 ast:: MetaItemKind :: Word => { } // actual lint names handled later
223223 ast:: MetaItemKind :: NameValue ( ref name_value) => {
224- if item. ident == "reason" {
224+ if item. path == "reason" {
225225 // found reason, reslice meta list to exclude it
226226 metas = & metas[ 0 ..metas. len ( ) -1 ] ;
227227 // FIXME (#55112): issue unused-attributes lint if we thereby
@@ -255,13 +255,13 @@ impl<'a> LintLevelsBuilder<'a> {
255255 }
256256
257257 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 ( ) ) ;
262262 if let Some ( item) = li. meta_item ( ) {
263263 if let ast:: MetaItemKind :: NameValue ( _) = item. node {
264- if item. ident == "reason" {
264+ if item. path == "reason" {
265265 err. help ( "reason in lint attribute must come last" ) ;
266266 }
267267 }
@@ -270,26 +270,27 @@ impl<'a> LintLevelsBuilder<'a> {
270270 continue ;
271271 }
272272 } ;
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) {
275276 span_err ! (
276277 sess,
277- lint_tool . span,
278+ tool_ident . span,
278279 E0710 ,
279280 "an unknown tool name found in scoped lint: `{}`" ,
280- word . ident
281+ meta_item . path
281282 ) ;
282283 continue ;
283284 }
284285
285- Some ( lint_tool . as_str ( ) )
286+ Some ( tool_ident . as_str ( ) )
286287 } else {
287288 None
288289 } ;
289- let name = word . name ( ) ;
290+ let name = meta_item . path . segments . last ( ) . expect ( "empty lint name" ) . ident . name ;
290291 match store. check_lint_name ( & name. as_str ( ) , tool_name) {
291292 CheckLintNameResult :: Ok ( ids) => {
292- let src = LintSource :: Node ( name, li. span , reason) ;
293+ let src = LintSource :: Node ( name, li. span ( ) , reason) ;
293294 for id in ids {
294295 specs. insert ( * id, ( level, src) ) ;
295296 }
@@ -300,7 +301,7 @@ impl<'a> LintLevelsBuilder<'a> {
300301 Ok ( ids) => {
301302 let complete_name = & format ! ( "{}::{}" , tool_name. unwrap( ) , name) ;
302303 let src = LintSource :: Node (
303- Symbol :: intern ( complete_name) , li. span , reason
304+ Symbol :: intern ( complete_name) , li. span ( ) , reason
304305 ) ;
305306 for id in ids {
306307 specs. insert ( * id, ( level, src) ) ;
@@ -322,18 +323,18 @@ impl<'a> LintLevelsBuilder<'a> {
322323 lint,
323324 lvl,
324325 src,
325- Some ( li. span . into ( ) ) ,
326+ Some ( li. span ( ) . into ( ) ) ,
326327 & msg,
327328 ) ;
328329 err. span_suggestion (
329- li. span ,
330+ li. span ( ) ,
330331 "change it to" ,
331332 new_lint_name. to_string ( ) ,
332333 Applicability :: MachineApplicable ,
333334 ) . emit ( ) ;
334335
335336 let src = LintSource :: Node (
336- Symbol :: intern ( & new_lint_name) , li. span , reason
337+ Symbol :: intern ( & new_lint_name) , li. span ( ) , reason
337338 ) ;
338339 for id in ids {
339340 specs. insert ( * id, ( level, src) ) ;
@@ -360,11 +361,11 @@ impl<'a> LintLevelsBuilder<'a> {
360361 lint,
361362 level,
362363 src,
363- Some ( li. span . into ( ) ) ,
364+ Some ( li. span ( ) . into ( ) ) ,
364365 & msg) ;
365366 if let Some ( new_name) = renamed {
366367 err. span_suggestion (
367- li. span ,
368+ li. span ( ) ,
368369 "use the new name" ,
369370 new_name,
370371 Applicability :: MachineApplicable
@@ -383,12 +384,12 @@ impl<'a> LintLevelsBuilder<'a> {
383384 lint,
384385 level,
385386 src,
386- Some ( li. span . into ( ) ) ,
387+ Some ( li. span ( ) . into ( ) ) ,
387388 & msg) ;
388389
389390 if let Some ( suggestion) = suggestion {
390391 db. span_suggestion (
391- li. span ,
392+ li. span ( ) ,
392393 "did you mean" ,
393394 suggestion. to_string ( ) ,
394395 Applicability :: MachineApplicable ,
0 commit comments