aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/codegen/gen_assists_docs.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-25 21:38:46 +0100
committerGitHub <[email protected]>2019-10-25 21:38:46 +0100
commit54d1a582812e01691ecb2f8ed11e8df9dda1530c (patch)
treed57842c6462f4921976d6d9642ce7751681cf0bd /xtask/src/codegen/gen_assists_docs.rs
parente6cb06d2850b9b9c38c0c13d6948ab39adcd652e (diff)
parentd385438bcc8d302fbcb91114e19ac0cc30528822 (diff)
Merge #2071
2071: generate more assists docs r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'xtask/src/codegen/gen_assists_docs.rs')
-rw-r--r--xtask/src/codegen/gen_assists_docs.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/xtask/src/codegen/gen_assists_docs.rs b/xtask/src/codegen/gen_assists_docs.rs
index 654ae09d6..e313820d1 100644
--- a/xtask/src/codegen/gen_assists_docs.rs
+++ b/xtask/src/codegen/gen_assists_docs.rs
@@ -1,7 +1,7 @@
1use std::{fs, path::Path}; 1use std::{fs, path::Path};
2 2
3use crate::{ 3use crate::{
4 codegen::{self, extract_comment_blocks, Mode}, 4 codegen::{self, extract_comment_blocks_with_empty_lines, Mode},
5 project_root, Result, 5 project_root, Result,
6}; 6};
7 7
@@ -34,7 +34,7 @@ fn collect_assists() -> Result<Vec<Assist>> {
34 34
35 fn collect_file(acc: &mut Vec<Assist>, path: &Path) -> Result<()> { 35 fn collect_file(acc: &mut Vec<Assist>, path: &Path) -> Result<()> {
36 let text = fs::read_to_string(path)?; 36 let text = fs::read_to_string(path)?;
37 let comment_blocks = extract_comment_blocks(&text); 37 let comment_blocks = extract_comment_blocks_with_empty_lines(&text);
38 38
39 for block in comment_blocks { 39 for block in comment_blocks {
40 // FIXME: doesn't support blank lines yet, need to tweak 40 // FIXME: doesn't support blank lines yet, need to tweak
@@ -45,7 +45,11 @@ fn collect_assists() -> Result<Vec<Assist>> {
45 continue; 45 continue;
46 } 46 }
47 let id = first_line["Assist: ".len()..].to_string(); 47 let id = first_line["Assist: ".len()..].to_string();
48 assert!(id.chars().all(|it| it.is_ascii_lowercase() || it == '_')); 48 assert!(
49 id.chars().all(|it| it.is_ascii_lowercase() || it == '_'),
50 "invalid assist id: {:?}",
51 id
52 );
49 53
50 let doc = take_until(lines.by_ref(), "```"); 54 let doc = take_until(lines.by_ref(), "```");
51 let before = take_until(lines.by_ref(), "```"); 55 let before = take_until(lines.by_ref(), "```");