diff options
-rw-r--r-- | crates/ra_ide/src/inlay_hints.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index b1661d238..da9f55a69 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -254,14 +254,19 @@ fn should_show_param_hint( | |||
254 | } | 254 | } |
255 | 255 | ||
256 | fn is_argument_similar_to_param(argument: &ast::Expr, param_name: &str) -> bool { | 256 | fn is_argument_similar_to_param(argument: &ast::Expr, param_name: &str) -> bool { |
257 | let argument_string = if let ast::Expr::RefExpr(ref_expr) = argument { | 257 | let argument_string = remove_ref(argument.clone()).syntax().to_string(); |
258 | ref_expr.syntax().last_token().expect("RefExpr should have a last_token").to_string() | ||
259 | } else { | ||
260 | argument.syntax().to_string() | ||
261 | }; | ||
262 | argument_string.starts_with(¶m_name) || argument_string.ends_with(¶m_name) | 258 | argument_string.starts_with(¶m_name) || argument_string.ends_with(¶m_name) |
263 | } | 259 | } |
264 | 260 | ||
261 | fn remove_ref(expr: ast::Expr) -> ast::Expr { | ||
262 | if let ast::Expr::RefExpr(ref_expr) = &expr { | ||
263 | if let Some(inner) = ref_expr.expr() { | ||
264 | return inner; | ||
265 | } | ||
266 | } | ||
267 | expr | ||
268 | } | ||
269 | |||
265 | fn is_obvious_param(param_name: &str) -> bool { | 270 | fn is_obvious_param(param_name: &str) -> bool { |
266 | let is_obvious_param_name = match param_name { | 271 | let is_obvious_param_name = match param_name { |
267 | "predicate" | "value" | "pat" | "rhs" | "other" => true, | 272 | "predicate" | "value" | "pat" | "rhs" | "other" => true, |