From 0c866ecf7626f09524b1fd0273d38943744eddb9 Mon Sep 17 00:00:00 2001 From: Connor Kuehl Date: Thu, 3 Sep 2020 16:12:40 -0500 Subject: [PATCH 1/2] Fix compile warning that pollutes a test case tests/multiple-bin-fail.rs ends up running the binary with "cargo run" so its warning output ends up getting collected in the test case. When it examines the subprocess's stderr, it fails the assertion because the compiler warning is included in it. --- src/readme/extract.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/readme/extract.rs b/src/readme/extract.rs index 5c220ca..c11c230 100644 --- a/src/readme/extract.rs +++ b/src/readme/extract.rs @@ -60,8 +60,7 @@ fn extract_docs_multiline_style( if let Some(pos) = line.rfind("*/") { nesting -= line.matches("*/").count() as isize; if nesting < 0 { - let mut line = line; - line.split_off(pos); + let line = line[0..pos].to_string(); if !line.trim().is_empty() { result.push(line); } From 4cf8d7ed931b2e7d9464512c5a0177304c0f0e42 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 19 Apr 2021 17:47:51 +0200 Subject: [PATCH 2/2] fix issue #38 --- src/readme/process.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/readme/process.rs b/src/readme/process.rs index b657233..bf0b0d7 100644 --- a/src/readme/process.rs +++ b/src/readme/process.rs @@ -45,7 +45,7 @@ impl Processor { pub fn process_line(&mut self, mut line: String) -> Option { // Skip lines that should be hidden in docs - if self.section == Section::CodeRust && line.starts_with("# ") { + if self.section == Section::CodeRust && (line.starts_with("# ") || line == "#") { return None; } @@ -104,6 +104,7 @@ mod tests { "```", "#[visible]", "let visible = \"visible\";", + "#", "# let hidden = \"hidden\";", "```", ];