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_syntax/src/ast | |
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_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/traits.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index f99984fe0..f8cf1e3eb 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs | |||
@@ -126,8 +126,8 @@ pub trait DocCommentsOwner: AstNode { | |||
126 | 126 | ||
127 | // Determine if the prefix or prefix + 1 char is stripped | 127 | // Determine if the prefix or prefix + 1 char is stripped |
128 | let pos = | 128 | let pos = |
129 | if line.chars().nth(prefix_len).map(|c| c.is_whitespace()).unwrap_or(false) { | 129 | if let Some(ws) = line.chars().nth(prefix_len).filter(|c| c.is_whitespace()) { |
130 | prefix_len + 1 | 130 | prefix_len + ws.len_utf8() |
131 | } else { | 131 | } else { |
132 | prefix_len | 132 | prefix_len |
133 | }; | 133 | }; |