aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_editor
diff options
context:
space:
mode:
authorJeremy A. Kolb <[email protected]>2018-11-07 14:13:16 +0000
committerAleksey Kladov <[email protected]>2018-11-07 15:24:55 +0000
commitc29f158c20ba57fc4a7067a493d79c38884ea1ec (patch)
treed584d4ec60ca43a5db0624498bd9b876b7265650 /crates/ra_editor
parenta83ed374d069e28c5e2715384fdd0a4c2c10aeea (diff)
Rustfmt to pass CI
Diffstat (limited to 'crates/ra_editor')
-rw-r--r--crates/ra_editor/src/symbols.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_editor/src/symbols.rs b/crates/ra_editor/src/symbols.rs
index bf3ac6ff2..f7681c76f 100644
--- a/crates/ra_editor/src/symbols.rs
+++ b/crates/ra_editor/src/symbols.rs
@@ -24,12 +24,17 @@ pub struct FileSymbol {
24 24
25impl FileSymbol { 25impl FileSymbol {
26 pub fn docs(&self, file: &File) -> Option<String> { 26 pub fn docs(&self, file: &File) -> Option<String> {
27 file.syntax().descendants() 27 file.syntax()
28 .descendants()
28 .filter(|node| node.kind() == self.kind && node.range() == self.node_range) 29 .filter(|node| node.kind() == self.kind && node.range() == self.node_range)
29 .filter_map(|node: SyntaxNodeRef| { 30 .filter_map(|node: SyntaxNodeRef| {
30 fn doc_comments<'a, N: DocCommentsOwner<'a>>(node: N) -> Option<String> { 31 fn doc_comments<'a, N: DocCommentsOwner<'a>>(node: N) -> Option<String> {
31 let comments = node.doc_comment_text(); 32 let comments = node.doc_comment_text();
32 if comments.is_empty() { None } else { Some(comments) } 33 if comments.is_empty() {
34 None
35 } else {
36 Some(comments)
37 }
33 } 38 }
34 39
35 visitor() 40 visitor()
@@ -42,7 +47,8 @@ impl FileSymbol {
42 .visit(doc_comments::<ast::ConstDef>) 47 .visit(doc_comments::<ast::ConstDef>)
43 .visit(doc_comments::<ast::StaticDef>) 48 .visit(doc_comments::<ast::StaticDef>)
44 .accept(node)? 49 .accept(node)?
45 }).nth(0) 50 })
51 .nth(0)
46 } 52 }
47} 53}
48 54