diff options
author | Zac Pullar-Strecker <[email protected]> | 2020-06-13 05:13:32 +0100 |
---|---|---|
committer | Zac Pullar-Strecker <[email protected]> | 2020-06-30 09:05:21 +0100 |
commit | 108b953254e46851130e427b41cd143eee07fd02 (patch) | |
tree | 4f14d14f0d85d5f8b5988a520de86f2c082b90f4 /crates/ra_syntax/src/ast | |
parent | 5f52a516dedeab16ede8c26807c4ff79b3d308d3 (diff) |
Remove local documentation link rewriting
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/test.txt | 15 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/traits.rs | 36 |
2 files changed, 0 insertions, 51 deletions
diff --git a/crates/ra_syntax/src/ast/test.txt b/crates/ra_syntax/src/ast/test.txt deleted file mode 100644 index f746bf1e7..000000000 --- a/crates/ra_syntax/src/ast/test.txt +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | The context is a general utility struct provided on event dispatches, which | ||
2 | helps with dealing with the current "context" of the event dispatch. | ||
3 | The context also acts as a general high-level interface over the associated | ||
4 | [`Shard`] which received the event, or the low-level [`http`] module. | ||
5 | |||
6 | The context contains "shortcuts", like for interacting with the shard. | ||
7 | Methods like [`set_activity`] will unlock the shard and perform an update for | ||
8 | you to save a bit of work. | ||
9 | |||
10 | A context will only live for the event it was dispatched for. After the | ||
11 | event handler finished, it is destroyed and will not be re-used. | ||
12 | |||
13 | [`Shard`]: ../gateway/struct.Shard.html | ||
14 | [`http`]: ../http/index.html | ||
15 | [`set_activity`]: #method.set_activity | ||
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index 323d78bbc..a8f2454fd 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs | |||
@@ -146,39 +146,3 @@ impl Iterator for CommentIter { | |||
146 | self.iter.by_ref().find_map(|el| el.into_token().and_then(ast::Comment::cast)) | 146 | self.iter.by_ref().find_map(|el| el.into_token().and_then(ast::Comment::cast)) |
147 | } | 147 | } |
148 | } | 148 | } |
149 | |||
150 | #[cfg(test)] | ||
151 | mod tests { | ||
152 | use comrak::{parse_document,format_commonmark, ComrakOptions, Arena}; | ||
153 | use comrak::nodes::{AstNode, NodeValue}; | ||
154 | |||
155 | fn iter_nodes<'a, F>(node: &'a AstNode<'a>, f: &F) | ||
156 | where F : Fn(&'a AstNode<'a>) { | ||
157 | f(node); | ||
158 | for c in node.children() { | ||
159 | iter_nodes(c, f); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | #[allow(non_snake_case)] | ||
164 | #[test] | ||
165 | fn test_link_rewrite() { | ||
166 | let src = include_str!("./test.txt"); | ||
167 | |||
168 | let arena = Arena::new(); | ||
169 | let doc = parse_document(&arena, src, &ComrakOptions::default()); | ||
170 | |||
171 | iter_nodes(doc, &|node| { | ||
172 | match &mut node.data.borrow_mut().value { | ||
173 | &mut NodeValue::Link(ref mut link) => { | ||
174 | link.url = "https://www.google.com".as_bytes().to_vec(); | ||
175 | }, | ||
176 | _ => () | ||
177 | } | ||
178 | }); | ||
179 | |||
180 | let mut out = Vec::new(); | ||
181 | format_commonmark(doc, &ComrakOptions::default(), &mut out); | ||
182 | panic!("{}", String::from_utf8(out).unwrap()); | ||
183 | } | ||
184 | } | ||