Skip to content

Commit 58621fa

Browse files
Merge pull request #292 from QuietMisdreavus/bad-slice
handle docs that don't use spaces in doc comments
2 parents b517745 + 46268a7 commit 58621fa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/db/add_package.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,10 @@ fn read_rust_doc(file_path: &Path) -> Result<Option<String>> {
260260
for line in reader.lines() {
261261
let line = try!(line);
262262
if line.starts_with("//!") {
263-
if line.len() > 3 {
264-
rustdoc.push_str(line.split_at(4).1);
263+
// some lines may or may not have a space between the `//!` and the start of the text
264+
let line = line.trim_start_matches("//!").trim_start();
265+
if !line.is_empty() {
266+
rustdoc.push_str(line);
265267
}
266268
rustdoc.push('\n');
267269
}

0 commit comments

Comments
 (0)