Skip to content

Commit

Permalink
Auto merge of rust-lang#12487 - lukechu10:master, r=lnicola
Browse files Browse the repository at this point in the history
minor: hide param inlay hint when argument is fn-like macro with similar name

Closes rust-lang#12486
  • Loading branch information
bors committed Jun 8, 2022
2 parents b967f17 + 6079eeb commit 79a4a46
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/ide/src/inlay_hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,9 @@ fn get_string_representation(expr: &ast::Expr) -> Option<String> {
name_ref => Some(name_ref.to_owned()),
}
}
ast::Expr::MacroExpr(macro_expr) => {
Some(macro_expr.macro_call()?.path()?.segment()?.to_string())
}
ast::Expr::FieldExpr(field_expr) => Some(field_expr.name_ref()?.to_string()),
ast::Expr::PathExpr(path_expr) => Some(path_expr.path()?.segment()?.to_string()),
ast::Expr::PrefixExpr(prefix_expr) => get_string_representation(&prefix_expr.expr()?),
Expand Down Expand Up @@ -1497,6 +1500,11 @@ fn main() {
foo(param2);
//^^^^^^ param
macro_rules! param {
() => {};
};
foo(param!());
let param_eter = 0;
bar(param_eter);
let param_eter_end = 0;
Expand Down

0 comments on commit 79a4a46

Please sign in to comment.