aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIceSentry <[email protected]>2020-04-09 00:26:47 +0100
committerIceSentry <[email protected]>2020-04-09 00:26:47 +0100
commitcba694c60276f7543ee9ed1dddf3fe93209f527f (patch)
treebbd8b29272bdc63c9f7ee9e904b7432b8485451b
parentde6db0632228ae61f7ec1f87eaf520ccd4e46925 (diff)
better `&mut ` and `&` matching
-rw-r--r--crates/ra_ide/src/inlay_hints.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 6b8b5813d..1da61e4c4 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -236,13 +236,13 @@ fn should_show_param_hint(
236 argument: &ast::Expr, 236 argument: &ast::Expr,
237) -> bool { 237) -> bool {
238 let argument_string = { 238 let argument_string = {
239 let arg_string = argument.syntax().to_string(); 239 let mut arg_string = argument.syntax().to_string();
240 let arg_split: Vec<char> = arg_string.chars().collect(); 240 if arg_string.get(0..5) == Some("&mut ") {
241 match arg_split.as_slice() { 241 arg_string = arg_string[5..].to_string();
242 ['&', 'm', 'u', 't', ' ', arg_name @ ..] => arg_name.into_iter().collect::<String>(), 242 } else if arg_string.get(0..1) == Some("&") {
243 ['&', arg_name @ ..] => arg_name.into_iter().collect::<String>(), 243 arg_string = arg_string[1..].to_string();
244 _ => arg_string,
245 } 244 }
245 arg_string
246 }; 246 };
247 if param_name.is_empty() 247 if param_name.is_empty()
248 || argument_string.ends_with(&param_name) 248 || argument_string.ends_with(&param_name)