Auto merge of #12201 - Veykril:inlay-hide, r=Veykril

fix: Add cast expressions to param name inlay hint heuristics
This commit is contained in:
bors 2022-05-10 11:44:06 +00:00
commit cf152e8a94
2 changed files with 3 additions and 1 deletions

View file

@ -808,6 +808,7 @@ fn get_string_representation(expr: &ast::Expr) -> Option<String> {
ast::Expr::PathExpr(path_expr) => Some(path_expr.path()?.segment()?.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()?), ast::Expr::PrefixExpr(prefix_expr) => get_string_representation(&prefix_expr.expr()?),
ast::Expr::RefExpr(ref_expr) => get_string_representation(&ref_expr.expr()?), ast::Expr::RefExpr(ref_expr) => get_string_representation(&ref_expr.expr()?),
ast::Expr::CastExpr(cast_expr) => get_string_representation(&cast_expr.expr()?),
_ => None, _ => None,
} }
} }
@ -1173,6 +1174,7 @@ fn main() {
let param = 0; let param = 0;
foo(param); foo(param);
foo(param as _);
let param_end = 0; let param_end = 0;
foo(param_end); foo(param_end);
let start_param = 0; let start_param = 0;

View file

@ -31,7 +31,7 @@ fn integrated_highlighting_benchmark() {
// Load rust-analyzer itself. // Load rust-analyzer itself.
let workspace_to_load = project_root(); let workspace_to_load = project_root();
let file = "./crates/ide_db/src/apply_change.rs"; let file = "./crates/ide-db/src/apply_change.rs";
let cargo_config = CargoConfig::default(); let cargo_config = CargoConfig::default();
let load_cargo_config = LoadCargoConfig { let load_cargo_config = LoadCargoConfig {