File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -335,17 +335,16 @@ impl SourceAnalyzer {
335
335
}
336
336
}
337
337
} else if is_path_of_attr {
338
- let res = resolve_hir_path_as_macro ( db, & self . resolver , & hir_path) ;
339
- return match res {
340
- Some ( _) => res. map ( PathResolution :: Macro ) ,
341
- None => path. as_single_name_ref ( ) . and_then ( |name_ref| {
342
- if let builtin @ Some ( _) = BuiltinAttr :: by_name ( & name_ref. text ( ) ) {
343
- builtin. map ( PathResolution :: BuiltinAttr )
344
- } else if let tool @ Some ( _) = ToolModule :: by_name ( & name_ref. text ( ) ) {
345
- tool. map ( PathResolution :: ToolModule )
346
- } else {
347
- None
348
- }
338
+ let name_ref = path. as_single_name_ref ( ) ;
339
+ let builtin =
340
+ name_ref. as_ref ( ) . map ( ast:: NameRef :: text) . as_deref ( ) . and_then ( BuiltinAttr :: by_name) ;
341
+ if let builtin @ Some ( _) = builtin {
342
+ return builtin. map ( PathResolution :: BuiltinAttr ) ;
343
+ }
344
+ return match resolve_hir_path_as_macro ( db, & self . resolver , & hir_path) {
345
+ res @ Some ( m) if m. is_attr ( ) => res. map ( PathResolution :: Macro ) ,
346
+ _ => name_ref. and_then ( |name_ref| {
347
+ ToolModule :: by_name ( & name_ref. text ( ) ) . map ( PathResolution :: ToolModule )
349
348
} ) ,
350
349
} ;
351
350
}
You can’t perform that action at this time.
0 commit comments