diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-31 14:36:52 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-31 14:36:52 +0100 |
commit | 62564008f7123917063066943a789ba651f99f8d (patch) | |
tree | ac2801be30223c32dbbf864ebf6c77a904edccdb /xtask/src/codegen | |
parent | 26d88ac94f7c64f17a2d5df891f1f77a096fedda (diff) | |
parent | 899570ad7abbc644e87d8379862c1b9f940eaf07 (diff) |
Merge #4672
4672: Link docs and code r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'xtask/src/codegen')
-rw-r--r-- | xtask/src/codegen/gen_assists_docs.rs | 4 | ||||
-rw-r--r-- | xtask/src/codegen/gen_feature_docs.rs | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/xtask/src/codegen/gen_assists_docs.rs b/xtask/src/codegen/gen_assists_docs.rs index 15a02d317..6c1be5350 100644 --- a/xtask/src/codegen/gen_assists_docs.rs +++ b/xtask/src/codegen/gen_assists_docs.rs | |||
@@ -64,7 +64,7 @@ impl Assist { | |||
64 | assert_eq!(lines.next().unwrap().as_str(), "->"); | 64 | assert_eq!(lines.next().unwrap().as_str(), "->"); |
65 | assert_eq!(lines.next().unwrap().as_str(), "```"); | 65 | assert_eq!(lines.next().unwrap().as_str(), "```"); |
66 | let after = take_until(lines.by_ref(), "```"); | 66 | let after = take_until(lines.by_ref(), "```"); |
67 | let location = Location::new(path.to_path_buf()); | 67 | let location = Location::new(path.to_path_buf(), block.line); |
68 | acc.push(Assist { id, location, doc, before, after }) | 68 | acc.push(Assist { id, location, doc, before, after }) |
69 | } | 69 | } |
70 | 70 | ||
@@ -90,6 +90,7 @@ impl fmt::Display for Assist { | |||
90 | writeln!( | 90 | writeln!( |
91 | f, | 91 | f, |
92 | "[discrete]\n=== `{}` | 92 | "[discrete]\n=== `{}` |
93 | **Source:** {} | ||
93 | 94 | ||
94 | {} | 95 | {} |
95 | 96 | ||
@@ -101,6 +102,7 @@ impl fmt::Display for Assist { | |||
101 | ```rust | 102 | ```rust |
102 | {}```", | 103 | {}```", |
103 | self.id, | 104 | self.id, |
105 | self.location, | ||
104 | self.doc, | 106 | self.doc, |
105 | hide_hash_comments(&before), | 107 | hide_hash_comments(&before), |
106 | hide_hash_comments(&after) | 108 | hide_hash_comments(&after) |
diff --git a/xtask/src/codegen/gen_feature_docs.rs b/xtask/src/codegen/gen_feature_docs.rs index 731e7ecf2..31bc3839d 100644 --- a/xtask/src/codegen/gen_feature_docs.rs +++ b/xtask/src/codegen/gen_feature_docs.rs | |||
@@ -40,7 +40,8 @@ impl Feature { | |||
40 | let id = block.id; | 40 | let id = block.id; |
41 | assert!(is_valid_feature_name(&id), "invalid feature name: {:?}", id); | 41 | assert!(is_valid_feature_name(&id), "invalid feature name: {:?}", id); |
42 | let doc = block.contents.join("\n"); | 42 | let doc = block.contents.join("\n"); |
43 | acc.push(Feature { id, location: Location::new(path.clone()), doc }) | 43 | let location = Location::new(path.clone(), block.line); |
44 | acc.push(Feature { id, location, doc }) | ||
44 | } | 45 | } |
45 | 46 | ||
46 | Ok(()) | 47 | Ok(()) |