Rustfmt to pass CI

This commit is contained in:
Jeremy A. Kolb 2018-11-07 09:13:16 -05:00 committed by Aleksey Kladov
parent a83ed374d0
commit c29f158c20
3 changed files with 12 additions and 6 deletions

View file

@ -261,7 +261,7 @@ impl Analysis {
pub fn doc_comment_for(
&self,
file_id: FileId,
symbol: FileSymbol
symbol: FileSymbol,
) -> Cancelable<Option<String>> {
self.imp.doc_comment_for(file_id, symbol)
}

View file

@ -24,12 +24,17 @@ pub struct FileSymbol {
impl FileSymbol {
pub fn docs(&self, file: &File) -> Option<String> {
file.syntax().descendants()
file.syntax()
.descendants()
.filter(|node| node.kind() == self.kind && node.range() == self.node_range)
.filter_map(|node: SyntaxNodeRef| {
fn doc_comments<'a, N: DocCommentsOwner<'a>>(node: N) -> Option<String> {
let comments = node.doc_comment_text();
if comments.is_empty() { None } else { Some(comments) }
if comments.is_empty() {
None
} else {
Some(comments)
}
}
visitor()
@ -42,7 +47,8 @@ impl FileSymbol {
.visit(doc_comments::<ast::ConstDef>)
.visit(doc_comments::<ast::StaticDef>)
.accept(node)?
}).nth(0)
})
.nth(0)
}
}

View file

@ -494,8 +494,8 @@ pub fn handle_hover(
return Ok(Some(Hover {
contents,
range: Some(range)
}))
range: Some(range),
}));
}
}