From 899570ad7abbc644e87d8379862c1b9f940eaf07 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 31 May 2020 15:36:20 +0200 Subject: Link to the specific source line --- xtask/src/codegen/gen_assists_docs.rs | 4 +++- xtask/src/codegen/gen_feature_docs.rs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'xtask/src/codegen') 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 { assert_eq!(lines.next().unwrap().as_str(), "->"); assert_eq!(lines.next().unwrap().as_str(), "```"); let after = take_until(lines.by_ref(), "```"); - let location = Location::new(path.to_path_buf()); + let location = Location::new(path.to_path_buf(), block.line); acc.push(Assist { id, location, doc, before, after }) } @@ -90,6 +90,7 @@ impl fmt::Display for Assist { writeln!( f, "[discrete]\n=== `{}` +**Source:** {} {} @@ -101,6 +102,7 @@ impl fmt::Display for Assist { ```rust {}```", self.id, + self.location, self.doc, hide_hash_comments(&before), 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 { let id = block.id; assert!(is_valid_feature_name(&id), "invalid feature name: {:?}", id); let doc = block.contents.join("\n"); - acc.push(Feature { id, location: Location::new(path.clone()), doc }) + let location = Location::new(path.clone(), block.line); + acc.push(Feature { id, location, doc }) } Ok(()) -- cgit v1.2.3