aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorShotaro Yamada <[email protected]>2020-02-19 04:13:29 +0000
committerShotaro Yamada <[email protected]>2020-02-19 04:13:29 +0000
commitdd0c3c41b927654553fa407fbb654bb3a2c64a48 (patch)
tree6d04ebc534ccfe332a86ad0b76a5f886ec5e6b9e /crates/ra_syntax
parent20252efb32bfdfe7392934a95a6c6d6b583d10e7 (diff)
Fix a crash with non-ascii whitespace in doc-comments
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/traits.rs4
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 };