diff --git a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs index 284fd7861d69..ed9db3263136 100644 --- a/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs +++ b/src/tools/rust-analyzer/crates/ide/src/goto_definition.rs @@ -14,7 +14,6 @@ use ide_db::{ FileId, RootDatabase, }; use itertools::Itertools; -use span::FileRange; use syntax::{ ast::{self, HasLoopBody, Label}, match_ast, AstNode, AstToken, diff --git a/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs b/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs index 065c3f2452e0..b1efd90d4e80 100644 --- a/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs +++ b/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs @@ -575,12 +575,20 @@ impl<'a> WalkExpandedExprCtx<'a> { } if let ast::Expr::MacroExpr(expr) = expr { - if let Some(expanded) = expr - .macro_call() - .and_then(|call| self.sema.expand(&call)) - .and_then(ast::MacroStmts::cast) + if let Some(expanded) = + expr.macro_call().and_then(|call| self.sema.expand(&call)) { - self.handle_expanded(expanded, cb); + match_ast! { + match expanded { + ast::MacroStmts(it) => { + self.handle_expanded(it, cb); + }, + ast::Expr(it) => { + self.walk(&it, cb); + }, + _ => {} + } + } } } }