@@ -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
} ;
@@ -254,9 +254,9 @@ 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 => {
257
+ let meta_item = match li. meta_item ( ) {
258
+ Some ( meta_item ) if meta_item . is_word ( ) => meta_item ,
259
+ _ => {
260
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 {
@@ -269,23 +269,24 @@ 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. ident . segments . len ( ) > 1 {
273
+ let tool_ident = meta_item. ident . 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 . ident
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 . ident . 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
292
let src = LintSource :: Node ( name, li. span , reason) ;
0 commit comments