diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-19 10:38:27 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-19 10:38:27 +0000 |
commit | d07f043ef1c99491cb172f3c3474b31c97501d7a (patch) | |
tree | 41099b8ebd3f8ca0aea64ac8623e8ac1140ca572 /crates/ra_ide/src/completion | |
parent | 20252efb32bfdfe7392934a95a6c6d6b583d10e7 (diff) | |
parent | d06733efebc5d8b378398f1cbb4bbd9f3deb8270 (diff) |
Merge #3229
3229: Fix a crash with non-ascii whitespace in doc-comments r=matklad a=sinkuu
2nd commit is a random drive-by cleanup.
Co-authored-by: Shotaro Yamada <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r-- | crates/ra_ide/src/completion/presentation.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs index 1a3bcffae..a524987fd 100644 --- a/crates/ra_ide/src/completion/presentation.rs +++ b/crates/ra_ide/src/completion/presentation.rs | |||
@@ -135,11 +135,7 @@ impl Completions { | |||
135 | let (before, after) = (&docs[..idx], &docs[idx + s.len()..]); | 135 | let (before, after) = (&docs[..idx], &docs[idx + s.len()..]); |
136 | // Ensure to match the full word | 136 | // Ensure to match the full word |
137 | if after.starts_with('!') | 137 | if after.starts_with('!') |
138 | && before | 138 | && !before.ends_with(|c: char| c == '_' || c.is_ascii_alphanumeric()) |
139 | .chars() | ||
140 | .rev() | ||
141 | .next() | ||
142 | .map_or(true, |c| c != '_' && !c.is_ascii_alphanumeric()) | ||
143 | { | 139 | { |
144 | // It may have spaces before the braces like `foo! {}` | 140 | // It may have spaces before the braces like `foo! {}` |
145 | match after[1..].chars().find(|&c| !c.is_whitespace()) { | 141 | match after[1..].chars().find(|&c| !c.is_whitespace()) { |