@@ -193,7 +193,7 @@ impl<'a> LintLevelsBuilder<'a> {
193193 struct_span_err ! ( sess, span, E0452 , "malformed lint attribute" )
194194 } ;
195195 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 ) ) {
197197 None => continue ,
198198 Some ( lvl) => lvl,
199199 } ;
@@ -220,7 +220,7 @@ impl<'a> LintLevelsBuilder<'a> {
220220 match item. node {
221221 ast:: MetaItemKind :: Word => { } // actual lint names handled later
222222 ast:: MetaItemKind :: NameValue ( ref name_value) => {
223- if item. ident == "reason" {
223+ if item. path == "reason" {
224224 // found reason, reslice meta list to exclude it
225225 metas = & metas[ 0 ..metas. len ( ) -1 ] ;
226226 // FIXME (#55112): issue unused-attributes lint if we thereby
@@ -254,13 +254,13 @@ impl<'a> LintLevelsBuilder<'a> {
254254 }
255255
256256 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 ( ) ) ;
261261 if let Some ( item) = li. meta_item ( ) {
262262 if let ast:: MetaItemKind :: NameValue ( _) = item. node {
263- if item. ident == "reason" {
263+ if item. path == "reason" {
264264 err. help ( "reason in lint attribute must come last" ) ;
265265 }
266266 }
@@ -269,26 +269,27 @@ impl<'a> LintLevelsBuilder<'a> {
269269 continue ;
270270 }
271271 } ;
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) {
274275 span_err ! (
275276 sess,
276- lint_tool . span,
277+ tool_ident . span,
277278 E0710 ,
278279 "an unknown tool name found in scoped lint: `{}`" ,
279- word . ident
280+ meta_item . path
280281 ) ;
281282 continue ;
282283 }
283284
284- Some ( lint_tool . as_str ( ) )
285+ Some ( tool_ident . as_str ( ) )
285286 } else {
286287 None
287288 } ;
288- let name = word . name ( ) ;
289+ let name = meta_item . path . segments . last ( ) . expect ( "empty lint name" ) . ident . name ;
289290 match store. check_lint_name ( & name. as_str ( ) , tool_name) {
290291 CheckLintNameResult :: Ok ( ids) => {
291- let src = LintSource :: Node ( name, li. span , reason) ;
292+ let src = LintSource :: Node ( name, li. span ( ) , reason) ;
292293 for id in ids {
293294 specs. insert ( * id, ( level, src) ) ;
294295 }
@@ -299,7 +300,7 @@ impl<'a> LintLevelsBuilder<'a> {
299300 Ok ( ids) => {
300301 let complete_name = & format ! ( "{}::{}" , tool_name. unwrap( ) , name) ;
301302 let src = LintSource :: Node (
302- Symbol :: intern ( complete_name) , li. span , reason
303+ Symbol :: intern ( complete_name) , li. span ( ) , reason
303304 ) ;
304305 for id in ids {
305306 specs. insert ( * id, ( level, src) ) ;
@@ -321,18 +322,18 @@ impl<'a> LintLevelsBuilder<'a> {
321322 lint,
322323 lvl,
323324 src,
324- Some ( li. span . into ( ) ) ,
325+ Some ( li. span ( ) . into ( ) ) ,
325326 & msg,
326327 ) ;
327328 err. span_suggestion (
328- li. span ,
329+ li. span ( ) ,
329330 "change it to" ,
330331 new_lint_name. to_string ( ) ,
331332 Applicability :: MachineApplicable ,
332333 ) . emit ( ) ;
333334
334335 let src = LintSource :: Node (
335- Symbol :: intern ( & new_lint_name) , li. span , reason
336+ Symbol :: intern ( & new_lint_name) , li. span ( ) , reason
336337 ) ;
337338 for id in ids {
338339 specs. insert ( * id, ( level, src) ) ;
@@ -359,11 +360,11 @@ impl<'a> LintLevelsBuilder<'a> {
359360 lint,
360361 level,
361362 src,
362- Some ( li. span . into ( ) ) ,
363+ Some ( li. span ( ) . into ( ) ) ,
363364 & msg) ;
364365 if let Some ( new_name) = renamed {
365366 err. span_suggestion (
366- li. span ,
367+ li. span ( ) ,
367368 "use the new name" ,
368369 new_name,
369370 Applicability :: MachineApplicable
@@ -382,12 +383,12 @@ impl<'a> LintLevelsBuilder<'a> {
382383 lint,
383384 level,
384385 src,
385- Some ( li. span . into ( ) ) ,
386+ Some ( li. span ( ) . into ( ) ) ,
386387 & msg) ;
387388
388389 if let Some ( suggestion) = suggestion {
389390 db. span_suggestion (
390- li. span ,
391+ li. span ( ) ,
391392 "did you mean" ,
392393 suggestion. to_string ( ) ,
393394 Applicability :: MachineApplicable ,
0 commit comments