From 822d9b55b731d44bc9161c96102a0b7ba2b5c52c Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 10 May 2022 13:43:43 +0200 Subject: [PATCH] fix: Add cast expressions to param name inlay hint heuristics --- crates/ide/src/inlay_hints.rs | 2 ++ crates/rust-analyzer/src/integrated_benchmarks.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index fa36241c8c..bd37ab8896 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs @@ -808,6 +808,7 @@ fn get_string_representation(expr: &ast::Expr) -> Option { 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::RefExpr(ref_expr) => get_string_representation(&ref_expr.expr()?), + ast::Expr::CastExpr(cast_expr) => get_string_representation(&cast_expr.expr()?), _ => None, } } @@ -1173,6 +1174,7 @@ fn main() { let param = 0; foo(param); + foo(param as _); let param_end = 0; foo(param_end); let start_param = 0; diff --git a/crates/rust-analyzer/src/integrated_benchmarks.rs b/crates/rust-analyzer/src/integrated_benchmarks.rs index b1f8958e92..4e6acaa877 100644 --- a/crates/rust-analyzer/src/integrated_benchmarks.rs +++ b/crates/rust-analyzer/src/integrated_benchmarks.rs @@ -31,7 +31,7 @@ fn integrated_highlighting_benchmark() { // Load rust-analyzer itself. 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 load_cargo_config = LoadCargoConfig {