aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/traits.rs
diff options
context:
space:
mode:
authorZac Pullar-Strecker <[email protected]>2020-06-13 05:13:32 +0100
committerZac Pullar-Strecker <[email protected]>2020-06-30 09:05:21 +0100
commit108b953254e46851130e427b41cd143eee07fd02 (patch)
tree4f14d14f0d85d5f8b5988a520de86f2c082b90f4 /crates/ra_syntax/src/ast/traits.rs
parent5f52a516dedeab16ede8c26807c4ff79b3d308d3 (diff)
Remove local documentation link rewriting
Diffstat (limited to 'crates/ra_syntax/src/ast/traits.rs')
-rw-r--r--crates/ra_syntax/src/ast/traits.rs36
1 files changed, 0 insertions, 36 deletions
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)]
151mod 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}