diff options
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/inlay_hints.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index 2ad8c33f2..3e9a65d9c 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs | |||
@@ -354,8 +354,11 @@ fn is_argument_similar_to_param_name( | |||
354 | match get_string_representation(argument) { | 354 | match get_string_representation(argument) { |
355 | None => false, | 355 | None => false, |
356 | Some(argument_string) => { | 356 | Some(argument_string) => { |
357 | let num_leading_underscores = | ||
358 | argument_string.bytes().take_while(|&c| c == b'_').count(); | ||
359 | |||
357 | // Does the argument name begin with the parameter name? Ignore leading underscores. | 360 | // Does the argument name begin with the parameter name? Ignore leading underscores. |
358 | let mut arg_bytes = argument_string.bytes().skip_while(|&c| c == b'_'); | 361 | let mut arg_bytes = argument_string.bytes().skip(num_leading_underscores); |
359 | let starts_with_pattern = param_name.bytes().all( | 362 | let starts_with_pattern = param_name.bytes().all( |
360 | |expected| matches!(arg_bytes.next(), Some(actual) if expected.eq_ignore_ascii_case(&actual)), | 363 | |expected| matches!(arg_bytes.next(), Some(actual) if expected.eq_ignore_ascii_case(&actual)), |
361 | ); | 364 | ); |
@@ -365,7 +368,7 @@ fn is_argument_similar_to_param_name( | |||
365 | } | 368 | } |
366 | 369 | ||
367 | // Does the argument name end with the parameter name? | 370 | // Does the argument name end with the parameter name? |
368 | let mut arg_bytes = argument_string.bytes(); | 371 | let mut arg_bytes = argument_string.bytes().skip(num_leading_underscores); |
369 | param_name.bytes().rev().all( | 372 | param_name.bytes().rev().all( |
370 | |expected| matches!(arg_bytes.next_back(), Some(actual) if expected.eq_ignore_ascii_case(&actual)), | 373 | |expected| matches!(arg_bytes.next_back(), Some(actual) if expected.eq_ignore_ascii_case(&actual)), |
371 | ) | 374 | ) |